diff options
author | Byron Jones <glob@mozilla.com> | 2015-06-15 06:49:59 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-06-15 06:49:59 +0200 |
commit | c290f3ecabec75b741d375e6130af9060255c274 (patch) | |
tree | 7f52627f41229c6d52a7b2115429c2ac408f438e /Bugzilla | |
parent | ac09f71cfd3e84a01a157a8cba21aec5513a0b14 (diff) | |
download | bugzilla-c290f3ecabec75b741d375e6130af9060255c274.tar.gz bugzilla-c290f3ecabec75b741d375e6130af9060255c274.tar.xz |
Bug 1146774: treeherder/tbpl comments are not automatically collapsed
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Comment.pm | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm index 979019541..69e973c7f 100644 --- a/Bugzilla/Comment.pm +++ b/Bugzilla/Comment.pm @@ -213,25 +213,31 @@ sub tags { sub collapsed { my ($self) = @_; - return 0 unless Bugzilla->params->{'comment_taggers_group'}; return $self->{collapsed} if exists $self->{collapsed}; + return 0 unless Bugzilla->params->{'comment_taggers_group'}; $self->{collapsed} = 0; Bugzilla->request_cache->{comment_tags_collapsed} - ||= [ split(/\s*,\s*/, Bugzilla->params->{'collapsed_comment_tags'}) ]; + ||= [ split(/\s*,\s*/, lc(Bugzilla->params->{'collapsed_comment_tags'})) ]; my @collapsed_tags = @{ Bugzilla->request_cache->{comment_tags_collapsed} }; - foreach my $my_tag (@{ $self->tags }) { - $my_tag = lc($my_tag); + my @reason; + foreach my $my_tag (map { lc } @{ $self->tags }) { foreach my $collapsed_tag (@collapsed_tags) { - if ($my_tag eq lc($collapsed_tag)) { - $self->{collapsed} = 1; - last; - } + push @reason, $my_tag if $my_tag eq $collapsed_tag; } - last if $self->{collapsed}; + } + if (@reason) { + $self->{collapsed} = 1; + $self->{collapsed_reason} = join(', ', sort @reason); } return $self->{collapsed}; } +sub collapsed_reason { + my ($self) = @_; + return 0 unless $self->collapsed; + return $self->{collapsed_reason}; +} + sub bug { my $self = shift; require Bugzilla::Bug; |