summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-05-31 23:29:31 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-05-31 23:29:31 +0200
commite31c0e9c22197ba938c6f4a853347edf54931700 (patch)
treeff9cd88a72c9e5cd8d969df2938be745a7bad5c7
parente1e8135e1a703adbb17fffcd8da9297286ba6877 (diff)
downloadbugzilla-e31c0e9c22197ba938c6f4a853347edf54931700.tar.gz
bugzilla-e31c0e9c22197ba938c6f4a853347edf54931700.tar.xz
Bug 1262459 - restyle the "this bug has been marked as a duplicate" comment
-rw-r--r--extensions/BugModal/lib/ActivityStream.pm15
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/activity_stream.html.tmpl4
2 files changed, 14 insertions, 5 deletions
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;