summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-04-11 09:11:32 +0200
committerByron Jones <bjones@mozilla.com>2013-04-11 09:11:32 +0200
commit861dd56bc901477eec23e060a143e24cc8b79384 (patch)
tree2c45b26f357d47f324ffa8320363a7d38c2927a8 /Bugzilla/User.pm
parentb7dbc39db88b25921af9a0b75c4bf43b8c2538f5 (diff)
downloadbugzilla-861dd56bc901477eec23e060a143e24cc8b79384.tar.gz
bugzilla-861dd56bc901477eec23e060a143e24cc8b79384.tar.xz
Bug 859480: Ability to ignore specific bugs (not get email from them, even as the reporter)
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm53
1 files changed, 53 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 151919bf8..2c11c2381 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -432,6 +432,31 @@ sub tags {
return $self->{tags};
}
+sub bugs_ignored {
+ my ($self) = @_;
+ my $dbh = Bugzilla->dbh;
+ if (!defined $self->{'bugs_ignored'}) {
+ $self->{'bugs_ignored'} = $dbh->selectall_arrayref(
+ 'SELECT bugs.bug_id AS id,
+ bugs.bug_status AS status,
+ bugs.short_desc AS summary
+ FROM bugs
+ INNER JOIN email_bug_ignore
+ ON bugs.bug_id = email_bug_ignore.bug_id
+ WHERE user_id = ?',
+ { Slice => {} }, $self->id);
+ # Go ahead and load these into the visible bugs cache
+ # to speed up can_see_bug checks later
+ $self->visible_bugs([ map { $_->{'id'} } @{ $self->{'bugs_ignored'} } ]);
+ }
+ return $self->{'bugs_ignored'};
+}
+
+sub is_bug_ignored {
+ my ($self, $bug_id) = @_;
+ return (grep {$_->{'id'} == $bug_id} @{$self->bugs_ignored}) ? 1 : 0;
+}
+
##########################
# Saved Recent Bug Lists #
##########################
@@ -2211,6 +2236,34 @@ groups.
Returns a hashref with tag IDs as key, and a hashref with tag 'id',
'name' and 'bug_count' as value.
+=item C<bugs_ignored>
+
+Returns an array of hashrefs containing information about bugs currently
+being ignored by the user.
+
+Each hashref contains the following information:
+
+=over
+
+=item C<id>
+
+C<int> The id of the bug.
+
+=item C<status>
+
+C<string> The current status of the bug.
+
+=item C<summary>
+
+C<string> The current summary of the bug.
+
+=back
+
+=item C<is_bug_ignored>
+
+Returns true if the user does not want email notifications for the
+specified bug ID, else returns false.
+
=back
=head2 Saved Recent Bug Lists