From e31c0e9c22197ba938c6f4a853347edf54931700 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 31 May 2016 21:29:31 +0000 Subject: Bug 1262459 - restyle the "this bug has been marked as a duplicate" comment --- extensions/BugModal/lib/ActivityStream.pm | 15 +++++++++++---- .../en/default/bug_modal/activity_stream.html.tmpl | 4 +++- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'extensions/BugModal') diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm index b3b8bbaa6..c9e053934 100644 --- a/extensions/BugModal/lib/ActivityStream.pm +++ b/extensions/BugModal/lib/ActivityStream.pm @@ -178,6 +178,12 @@ sub _add_comments_to_stream { $comment->{collapsed} = 1; $comment->{collapsed_reason} = 'empty'; } + # If comment type is resolved as duplicate, do not add '...marked as duplicate...' string to comment body + if ($comment->type == CMT_DUPE_OF) { + $comment->set_type(0); + # Skip if user did not supply comment also + next if $comment->body eq ''; + } _add_comment_to_stream($stream, date_str_to_time($comment->creation_ts), $comment->author->id, $comment); } @@ -345,20 +351,21 @@ sub _add_duplicates_to_stream { SELECT longdescs.who, UNIX_TIMESTAMP(bug_when), " . $dbh->sql_date_format('bug_when') . ", + type, extra_data FROM longdescs INNER JOIN profiles ON profiles.userid = longdescs.who - WHERE bug_id = ? AND type = ? + WHERE bug_id = ? AND (type = ? OR type = ?) ORDER BY bug_when "); - $sth->execute($bug->id, CMT_HAS_DUPE); + $sth->execute($bug->id, CMT_HAS_DUPE, CMT_DUPE_OF); - while (my($who, $time, $when, $dupe_id) = $sth->fetchrow_array) { + while (my($who, $time, $when, $type, $dupe_id) = $sth->fetchrow_array) { _add_activity_to_stream($stream, $time, $who, { who => Bugzilla::User->new({ id => $who, cache => 1 }), when => $when, changes => [{ - fieldname => 'duplicate', + fieldname => ($type == CMT_HAS_DUPE ? 'has_dupe' : 'dupe_of'), added => $dupe_id, buglist => 1, }], diff --git a/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl index e15f8837b..807f5772f 100644 --- a/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl @@ -254,8 +254,10 @@ END; IF change.buglist; - IF change.fieldname == 'duplicate'; + IF change.fieldname == 'has_dupe'; label = "Duplicate of this " _ terms.bug; + ELSIF change.fieldname == 'dupe_of'; + label = "Duplicate of " _ terms.bug; ELSE; label = field_descs.${change.fieldname}; END; -- cgit v1.2.3-24-g4f1b