From c290f3ecabec75b741d375e6130af9060255c274 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 15 Jun 2015 12:49:59 +0800 Subject: Bug 1146774: treeherder/tbpl comments are not automatically collapsed --- extensions/BugModal/lib/ActivityStream.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'extensions/BugModal/lib/ActivityStream.pm') 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); } } -- cgit v1.2.3-24-g4f1b