summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal/lib
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/BugModal/lib')
-rw-r--r--extensions/BugModal/lib/ActivityStream.pm11
-rw-r--r--extensions/BugModal/lib/MonkeyPatches.pm13
2 files changed, 23 insertions, 1 deletions
diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm
index b66352031..a69790044 100644
--- a/extensions/BugModal/lib/ActivityStream.pm
+++ b/extensions/BugModal/lib/ActivityStream.pm
@@ -109,12 +109,21 @@ sub _add_activity_to_stream {
sub _add_comments_to_stream {
my ($bug, $stream) = @_;
my $user = Bugzilla->user;
+ my $treeherder_id = Bugzilla->treeherder_user->id;
my $raw_comments = $bug->comments();
foreach my $comment (@$raw_comments) {
next if $comment->type == CMT_HAS_DUPE;
- next if $comment->is_private && !($user->is_insider || $user->id == $comment->author->id);
+ my $author_id = $comment->author->id;
+ next if $comment->is_private && !($user->is_insider || $user->id == $author_id);
next if $comment->body eq '' && ($comment->work_time - 0) != 0 && !$user->is_timetracker;
+
+ # treeherder is so spammy we hide its comments by default
+ if ($author_id == $treeherder_id) {
+ $comment->{collapsed} = 1;
+ $comment->{collapsed_reason} = $comment->author->name;
+ }
+
_add_comment_to_stream($stream, date_str_to_time($comment->creation_ts), $comment->author->id, $comment);
}
}
diff --git a/extensions/BugModal/lib/MonkeyPatches.pm b/extensions/BugModal/lib/MonkeyPatches.pm
index 596746b32..c2e24f5ce 100644
--- a/extensions/BugModal/lib/MonkeyPatches.pm
+++ b/extensions/BugModal/lib/MonkeyPatches.pm
@@ -8,6 +8,19 @@
package Bugzilla::Extension::BugModal::MonkeyPatches;
1;
+package Bugzilla;
+use strict;
+use warnings;
+
+use Bugzilla::User;
+
+sub treeherder_user {
+ return Bugzilla->process_cache->{treeherder_user} //=
+ Bugzilla::User->new({ name => 'tbplbot@gmail.com', cache => 1 })
+ || Bugzilla::User->new({ name => 'treeherder@bots.tld', cache => 1 })
+ || Bugzilla::User->new();
+}
+
package Bugzilla::Bug;
use strict;
use warnings;