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 {
}
}
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
......
......@@ -56,13 +56,7 @@ sub get_param_list {
name => 'allowuserdeletion',
type => 'b',
default => 0
},
{
name => 'supportwatchers',
type => 'b',
default => 0
} );
});
return @param_list;
}
......
......@@ -250,34 +250,11 @@
<section id="param-admin-policies">
<title>Administrative Policies</title>
<para>
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).
</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>
<para>
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.
</para>
</section>
<section id="param-user-authentication">
......
......@@ -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('<input type="button" value="Disable All Mail" onclick="SetCheckb
[% END %]
[% END %]
[% IF Param('supportwatchers') %]
<hr>
<b>User Watching</b>
......@@ -306,8 +304,6 @@ You are currently not watching any users.
[% END %]
</p>
[% END %]
<hr>
<br>
......@@ -37,9 +37,5 @@
"$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. " _
"So, you have to turn on this option before any such deletions " _
"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}." }
"will ever happen." }
%]
\ No newline at end of file
......@@ -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();
......
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