Commit e087aa60 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 399072: Remove the 'supportwatchers' parameter - Patch by Fré©ric Buclin…

Bug 399072: Remove the 'supportwatchers' parameter - Patch by Fré©ric Buclin <LpSolit@gmail.com> r/a=mkanat
parent 65792b68
...@@ -410,23 +410,21 @@ sub Send { ...@@ -410,23 +410,21 @@ sub Send {
} }
} }
if (Bugzilla->params->{"supportwatchers"}) { # Find all those user-watching anyone on the current list, who is not
# Find all those user-watching anyone on the current list, who is not # on it already themselves.
# on it already themselves. my $involved = join(",", keys %recipients);
my $involved = join(",", keys %recipients);
my $userwatchers =
my $userwatchers = $dbh->selectall_arrayref("SELECT watcher, watched FROM watch
$dbh->selectall_arrayref("SELECT watcher, watched FROM watch WHERE watched IN ($involved)");
WHERE watched IN ($involved)");
# Mark these people as having the role of the person they are watching
# Mark these people as having the role of the person they are watching foreach my $watch (@$userwatchers) {
foreach my $watch (@$userwatchers) { while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) {
while (my ($role, $bits) = each %{$recipients{$watch->[1]}}) { $recipients{$watch->[0]}->{$role} |= BIT_WATCHING
$recipients{$watch->[0]}->{$role} |= BIT_WATCHING if $bits & BIT_DIRECT;
if $bits & BIT_DIRECT;
}
push (@{$watching{$watch->[0]}}, $watch->[1]);
} }
push(@{$watching{$watch->[0]}}, $watch->[1]);
} }
# Global watcher # Global watcher
......
...@@ -56,13 +56,7 @@ sub get_param_list { ...@@ -56,13 +56,7 @@ sub get_param_list {
name => 'allowuserdeletion', name => 'allowuserdeletion',
type => 'b', type => 'b',
default => 0 default => 0
}, });
{
name => 'supportwatchers',
type => 'b',
default => 0
} );
return @param_list; return @param_list;
} }
......
...@@ -250,34 +250,11 @@ ...@@ -250,34 +250,11 @@
<section id="param-admin-policies"> <section id="param-admin-policies">
<title>Administrative Policies</title> <title>Administrative Policies</title>
<para> <para>
This page contains parameters for basic administrative functions. This page contains parameters for basic administrative functions.
Options include whether to allow the deletion of bugs and users, whether Options include whether to allow the deletion of bugs and users,
to allow users to change their email address, and whether to allow and whether to allow users to change their email address.
user watching (one user receiving all notifications of a selected </para>
other user).
</para>
<variablelist>
<varlistentry>
<term>
supportwatchers
</term>
<listitem>
<para>
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 <quote>watchers</quote> will only be
copied on emails from bugs they would normally be allowed to view.
</para>
</listitem>
</varlistentry>
</variablelist>
</section> </section>
<section id="param-user-authentication"> <section id="param-user-authentication">
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
# below), keyed by reasonname (e.g. comments; again, see # below), keyed by reasonname (e.g. comments; again, see
# below). The value is a boolean - true if the user is # below). The value is a boolean - true if the user is
# receiving mail for that reason when in that role. # receiving mail for that reason when in that role.
# Also references the 'supportwatchers' Param.
#%] #%]
[% PROCESS global/variables.none.tmpl %] [% PROCESS global/variables.none.tmpl %]
...@@ -264,7 +263,6 @@ document.write('<input type="button" value="Disable All Mail" onclick="SetCheckb ...@@ -264,7 +263,6 @@ document.write('<input type="button" value="Disable All Mail" onclick="SetCheckb
[% END %] [% END %]
[% END %] [% END %]
[% IF Param('supportwatchers') %]
<hr> <hr>
<b>User Watching</b> <b>User Watching</b>
...@@ -306,8 +304,6 @@ You are currently not watching any users. ...@@ -306,8 +304,6 @@ You are currently not watching any users.
[% END %] [% END %]
</p> </p>
[% END %]
<hr> <hr>
<br> <br>
...@@ -37,9 +37,5 @@ ...@@ -37,9 +37,5 @@
"$terms.Bugzilla will issue a warning in case you'd run into inconsistencies " _ "$terms.Bugzilla will issue a warning in case you'd run into inconsistencies " _
"when you're about to do so, but such deletions remain kinda scary. " _ "when you're about to do so, but such deletions remain kinda scary. " _
"So, you have to turn on this option before any such deletions " _ "So, you have to turn on this option before any such deletions " _
"will ever happen.", "will ever happen." }
supportwatchers => "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}." }
%] %]
\ No newline at end of file
...@@ -205,29 +205,27 @@ sub DoEmail { ...@@ -205,29 +205,27 @@ sub DoEmail {
########################################################################### ###########################################################################
# User watching # User watching
########################################################################### ###########################################################################
if (Bugzilla->params->{"supportwatchers"}) { my $watched_ref = $dbh->selectcol_arrayref(
my $watched_ref = $dbh->selectcol_arrayref( "SELECT profiles.login_name FROM watch INNER JOIN profiles" .
"SELECT profiles.login_name FROM watch INNER JOIN profiles" . " ON watch.watched = profiles.userid" .
" ON watch.watched = profiles.userid" . " WHERE watcher = ?" .
" WHERE watcher = ?" . " ORDER BY profiles.login_name",
" ORDER BY profiles.login_name", undef, $user->id);
undef, $user->id); $vars->{'watchedusers'} = $watched_ref;
$vars->{'watchedusers'} = $watched_ref;
my $watcher_ids = $dbh->selectcol_arrayref(
my $watcher_ids = $dbh->selectcol_arrayref( "SELECT watcher FROM watch WHERE watched = ?",
"SELECT watcher FROM watch WHERE watched = ?", undef, $user->id);
undef, $user->id);
my @watchers;
my @watchers; foreach my $watcher_id (@$watcher_ids) {
foreach my $watcher_id (@$watcher_ids) { my $watcher = new Bugzilla::User($watcher_id);
my $watcher = new Bugzilla::User($watcher_id); push(@watchers, Bugzilla::User::identity($watcher));
push (@watchers, Bugzilla::User::identity($watcher));
}
@watchers = sort { lc($a) cmp lc($b) } @watchers;
$vars->{'watchers'} = \@watchers;
} }
@watchers = sort { lc($a) cmp lc($b) } @watchers;
$vars->{'watchers'} = \@watchers;
########################################################################### ###########################################################################
# Role-based preferences # Role-based preferences
########################################################################### ###########################################################################
...@@ -249,9 +247,7 @@ sub SaveEmail { ...@@ -249,9 +247,7 @@ sub SaveEmail {
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $user = Bugzilla->user; 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 # Role-based preferences
...@@ -308,9 +304,8 @@ sub SaveEmail { ...@@ -308,9 +304,8 @@ sub SaveEmail {
########################################################################### ###########################################################################
# User watching # User watching
########################################################################### ###########################################################################
if (Bugzilla->params->{"supportwatchers"} if (defined $cgi->param('new_watchedusers')
&& (defined $cgi->param('new_watchedusers') || defined $cgi->param('remove_watched_users'))
|| defined $cgi->param('remove_watched_users')))
{ {
$dbh->bz_start_transaction(); $dbh->bz_start_transaction();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment