From e087aa6018bab95f403c836d12b30bb5ed39a626 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 10 Dec 2008 18:26:51 +0000 Subject: Bug 399072: Remove the 'supportwatchers' parameter - Patch by Frédéric Buclin r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/BugMail.pm | 30 +++++++------- Bugzilla/Config/Admin.pm | 8 +--- docs/en/xml/administration.xml | 33 +++------------ template/en/default/account/prefs/email.html.tmpl | 4 -- template/en/default/admin/params/admin.html.tmpl | 6 +-- userprefs.cgi | 49 ++++++++++------------- 6 files changed, 43 insertions(+), 87 deletions(-) diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 4e91d4be4..9a5e1a4c9 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -410,23 +410,21 @@ sub Send { } } - if (Bugzilla->params->{"supportwatchers"}) { - # Find all those user-watching anyone on the current list, who is not - # on it already themselves. - my $involved = join(",", keys %recipients); - - my $userwatchers = - $dbh->selectall_arrayref("SELECT watcher, watched FROM watch - WHERE watched IN ($involved)"); - - # Mark these people as having the role of the person they are watching - foreach my $watch (@$userwatchers) { - while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) { - $recipients{$watch->[0]}->{$role} |= BIT_WATCHING - if $bits & BIT_DIRECT; - } - push (@{$watching{$watch->[0]}}, $watch->[1]); + # Find all those user-watching anyone on the current list, who is not + # on it already themselves. + my $involved = join(",", keys %recipients); + + my $userwatchers = + $dbh->selectall_arrayref("SELECT watcher, watched FROM watch + WHERE watched IN ($involved)"); + + # Mark these people as having the role of the person they are watching + foreach my $watch (@$userwatchers) { + while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) { + $recipients{$watch->[0]}->{$role} |= BIT_WATCHING + if $bits & BIT_DIRECT; } + push(@{$watching{$watch->[0]}}, $watch->[1]); } # Global watcher diff --git a/Bugzilla/Config/Admin.pm b/Bugzilla/Config/Admin.pm index 838e53295..18818e6b5 100644 --- a/Bugzilla/Config/Admin.pm +++ b/Bugzilla/Config/Admin.pm @@ -56,13 +56,7 @@ sub get_param_list { name => 'allowuserdeletion', type => 'b', default => 0 - }, - - { - name => 'supportwatchers', - type => 'b', - default => 0 - } ); + }); return @param_list; } diff --git a/docs/en/xml/administration.xml b/docs/en/xml/administration.xml index 77f02c0f6..df5671502 100644 --- a/docs/en/xml/administration.xml +++ b/docs/en/xml/administration.xml @@ -250,34 +250,11 @@
Administrative Policies - - This page contains parameters for basic administrative functions. - Options include whether to allow the deletion of bugs and users, whether - to allow users to change their email address, and whether to allow - user watching (one user receiving all notifications of a selected - other user). - - - - - - - supportwatchers - - - - Turning on this option allows users to ask to receive copies - of bug mail sent to another user. Watching a user with - different group permissions is not a way to 'get around' the - system; copied emails are still subject to the normal groupset - permissions of a bug, and watchers will only be - copied on emails from bugs they would normally be allowed to view. - - - - - - + + This page contains parameters for basic administrative functions. + Options include whether to allow the deletion of bugs and users, + and whether to allow users to change their email address. +
diff --git a/template/en/default/account/prefs/email.html.tmpl b/template/en/default/account/prefs/email.html.tmpl index 57c76a93e..a4d22db73 100644 --- a/template/en/default/account/prefs/email.html.tmpl +++ b/template/en/default/account/prefs/email.html.tmpl @@ -31,7 +31,6 @@ # below), keyed by reasonname (e.g. comments; again, see # below). The value is a boolean - true if the user is # receiving mail for that reason when in that role. - # Also references the 'supportwatchers' Param. #%] [% PROCESS global/variables.none.tmpl %] @@ -264,7 +263,6 @@ document.write(' "Support one user watching (ie getting copies of all related " _ - "email about) another's ${terms.bugs}. Useful for people going on " _ - "vacation, and QA folks watching particular developers' ${terms.bugs}." } + "will ever happen." } %] \ No newline at end of file diff --git a/userprefs.cgi b/userprefs.cgi index 4ce0f5715..1bf2d7f5f 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -205,29 +205,27 @@ sub DoEmail { ########################################################################### # User watching ########################################################################### - if (Bugzilla->params->{"supportwatchers"}) { - my $watched_ref = $dbh->selectcol_arrayref( - "SELECT profiles.login_name FROM watch INNER JOIN profiles" . - " ON watch.watched = profiles.userid" . - " WHERE watcher = ?" . - " ORDER BY profiles.login_name", - undef, $user->id); - $vars->{'watchedusers'} = $watched_ref; - - my $watcher_ids = $dbh->selectcol_arrayref( - "SELECT watcher FROM watch WHERE watched = ?", - undef, $user->id); - - my @watchers; - foreach my $watcher_id (@$watcher_ids) { - my $watcher = new Bugzilla::User($watcher_id); - push (@watchers, Bugzilla::User::identity($watcher)); - } - - @watchers = sort { lc($a) cmp lc($b) } @watchers; - $vars->{'watchers'} = \@watchers; + my $watched_ref = $dbh->selectcol_arrayref( + "SELECT profiles.login_name FROM watch INNER JOIN profiles" . + " ON watch.watched = profiles.userid" . + " WHERE watcher = ?" . + " ORDER BY profiles.login_name", + undef, $user->id); + $vars->{'watchedusers'} = $watched_ref; + + my $watcher_ids = $dbh->selectcol_arrayref( + "SELECT watcher FROM watch WHERE watched = ?", + undef, $user->id); + + my @watchers; + foreach my $watcher_id (@$watcher_ids) { + my $watcher = new Bugzilla::User($watcher_id); + push(@watchers, Bugzilla::User::identity($watcher)); } + @watchers = sort { lc($a) cmp lc($b) } @watchers; + $vars->{'watchers'} = \@watchers; + ########################################################################### # Role-based preferences ########################################################################### @@ -249,9 +247,7 @@ sub SaveEmail { my $cgi = Bugzilla->cgi; my $user = Bugzilla->user; - if (Bugzilla->params->{"supportwatchers"}) { - Bugzilla::User::match_field($cgi, { 'new_watchedusers' => {'type' => 'multi'} }); - } + Bugzilla::User::match_field($cgi, { 'new_watchedusers' => {'type' => 'multi'} }); ########################################################################### # Role-based preferences @@ -308,9 +304,8 @@ sub SaveEmail { ########################################################################### # User watching ########################################################################### - if (Bugzilla->params->{"supportwatchers"} - && (defined $cgi->param('new_watchedusers') - || defined $cgi->param('remove_watched_users'))) + if (defined $cgi->param('new_watchedusers') + || defined $cgi->param('remove_watched_users')) { $dbh->bz_start_transaction(); -- cgit v1.2.3-24-g4f1b