diff options
author | David Lawrence <dkl@mozilla.com> | 2014-10-23 19:40:55 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2014-10-23 19:40:55 +0200 |
commit | 97ac79dcfee3a1b19a20816a31b0a79194ae75fe (patch) | |
tree | 9909f3825e00105830b39c7e03a79f18dcc60a05 | |
parent | 09ff8eeb2d7a5e92d6a29b99ecaf0984a89db35b (diff) | |
download | bugzilla-97ac79dcfee3a1b19a20816a31b0a79194ae75fe.tar.gz bugzilla-97ac79dcfee3a1b19a20816a31b0a79194ae75fe.tar.xz |
Bug 1082113: The ComponentWatching extension should create a default watch user with a new database installation
-rw-r--r-- | extensions/ComponentWatching/Extension.pm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/extensions/ComponentWatching/Extension.pm b/extensions/ComponentWatching/Extension.pm index 627fb12fd..38b1abb3c 100644 --- a/extensions/ComponentWatching/Extension.pm +++ b/extensions/ComponentWatching/Extension.pm @@ -164,8 +164,23 @@ sub object_before_create { my $params = $args->{params}; return unless $class->isa('Bugzilla::Component'); - my $input = Bugzilla->input_params; - $params->{watch_user} = $input->{watch_user}; + # We need to create a watch user for the default product/component + # if we are creating the database for the first time. + my $dbh = Bugzilla->dbh; + if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE + && !$dbh->selectrow_array('SELECT 1 FROM components')) + { + my $watch_user = Bugzilla::User->create({ + login_name => 'testcomponent@testproduct.bugs', + cryptpassword => '*', + disable_mail => 1 + }); + $params->{watch_user} = $watch_user->login; + } + else { + my $input = Bugzilla->input_params; + $params->{watch_user} = $input->{watch_user}; + } } sub object_end_of_update { |