From: Kohei Yoshino Date: Tue, 23 Apr 2019 22:30:47 +0000 (-0400) Subject: Bug 1544132 - Allow editing empty Descriptions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a99af70ff5d6bb3e2300268b04d5c1db1a39ce9c;p=thirdparty%2Fbugzilla.git Bug 1544132 - Allow editing empty Descriptions --- diff --git a/extensions/BugModal/lib/ActivityStream.pm b/extensions/BugModal/lib/ActivityStream.pm index a0e1b18fd..18e3370cc 100644 --- a/extensions/BugModal/lib/ActivityStream.pm +++ b/extensions/BugModal/lib/ActivityStream.pm @@ -179,14 +179,6 @@ sub _add_comments_to_stream { $comment->{collapsed_reason} = $comment->author->name; } - if ( $comment->type != CMT_ATTACHMENT_CREATED - && $comment->count == 0 - && length($comment->body) == 0) - { - $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); 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 55c792dfa..95881ded9 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 @@ -142,7 +142,7 @@ [% END %] @@ -290,13 +290,19 @@ [% comment_tag = 'pre' %] [% END %] - [% IF comment.body %] + [%# Description (Comment 0) can be empty %] + [% IF comment.body || comment.count == 0 %] <[% comment_tag FILTER none %] - class="comment-text [%= "markdown-body" IF comment.is_markdown %] [%= "bz_private" IF comment.is_private %]" + class="comment-text [%= "markdown-body" IF comment.is_markdown %] [%= "bz_private" IF comment.is_private %] + [% "empty" IF !comment.body %]" id="ct-[% comment.count FILTER none %]" data-comment-id="[% comment.id FILTER none %]" [% IF comment.is_markdown +%] data-ismarkdown="true" [% END ~%] [% IF comment.collapsed +%] style="display:none"[% END ~%]> - [%~ comment.body_full({ exclude_attachment => 1 }) FILTER renderMarkdown(bug, comment) ~%] + [%~ IF comment.body ~%] + [%~ comment.body_full({ exclude_attachment => 1 }) FILTER renderMarkdown(bug, comment) ~%] + [%~ ELSE ~%] + No description provided. + [%~ END ~%] [% END %] [% END %] diff --git a/extensions/EditComments/template/en/default/hook/bug_modal/activity_stream-comment_action.html.tmpl b/extensions/EditComments/template/en/default/hook/bug_modal/activity_stream-comment_action.html.tmpl index 76208017e..8ef264ac9 100644 --- a/extensions/EditComments/template/en/default/hook/bug_modal/activity_stream-comment_action.html.tmpl +++ b/extensions/EditComments/template/en/default/hook/bug_modal/activity_stream-comment_action.html.tmpl @@ -7,7 +7,7 @@ #%] [% - RETURN IF comment.body == ''; + RETURN UNLESS comment.body || comment.count == 0; RETURN UNLESS user.is_insider || Param('edit_comments_group') && user.in_group(Param('edit_comments_group')) && comment.author.id == user.id; RETURN UNLESS diff --git a/extensions/EditComments/template/en/default/pages/comment-revisions.html.tmpl b/extensions/EditComments/template/en/default/pages/comment-revisions.html.tmpl index d4cc4e0b8..b2859d389 100644 --- a/extensions/EditComments/template/en/default/pages/comment-revisions.html.tmpl +++ b/extensions/EditComments/template/en/default/pages/comment-revisions.html.tmpl @@ -40,6 +40,8 @@
[% IF !user.is_insider && a.is_hidden %]
(Hidden by Administrator)
+ [% ELSIF comment.count == 0 && !a.new %] +
No description provided.
[% ELSE %]
[% a.new FILTER quoteUrls(bug) %]
[% END %] diff --git a/extensions/EditComments/web/js/inline-editor.js b/extensions/EditComments/web/js/inline-editor.js index 8c92bcf1f..6ddf668a6 100644 --- a/extensions/EditComments/web/js/inline-editor.js +++ b/extensions/EditComments/web/js/inline-editor.js @@ -48,7 +48,8 @@ Bugzilla.InlineCommentEditor = class InlineCommentEditor { this.$edit_button.addEventListener('click', event => this.edit_button_onclick(event)); - // Check if the comment is written in Markdown + // Check if the comment is empty or written in Markdown + this.is_empty = this.$body.matches('.empty'); this.is_markdown = this.$body.matches('[data-ismarkdown="true"]'); } @@ -140,6 +141,12 @@ Bugzilla.InlineCommentEditor = class InlineCommentEditor { // Adjust the height of `