From 479900d7cf4a90eeb4e75ec5f3081a34bac93523 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Fri, 11 Jan 2019 17:15:08 -0500 Subject: [PATCH] Bug 1518967 - Edit attachment as comment does markdown, which is very unexpected --- attachment.cgi | 20 +++++++++++-------- .../hook/attachment/edit-view.html.tmpl | 1 + template/en/default/attachment/edit.html.tmpl | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/attachment.cgi b/attachment.cgi index b165651e4..df1b009fb 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -619,10 +619,10 @@ sub insert { $bug->add_comment( $comment, { - isprivate => $attachment->isprivate, - type => CMT_ATTACHMENT_CREATED, - extra_data => $attachment->id, - is_markdown => Bugzilla->params->{use_markdown} ? 1 : 0 + isprivate => $attachment->isprivate, + type => CMT_ATTACHMENT_CREATED, + extra_data => $attachment->id, + is_markdown => Bugzilla->params->{use_markdown} ? 1 : 0, } ); @@ -775,14 +775,18 @@ sub update { # If the user submitted a comment while editing the attachment, # add the comment to the bug. Do this after having validated isprivate! my $comment = $cgi->param('comment'); + my $is_markdown = Bugzilla->params->{use_markdown} ? 1 : 0; + if ($cgi->param('markdown_off')) { + $is_markdown = 0; + } if (defined $comment && trim($comment) ne '') { $bug->add_comment( $comment, { - isprivate => $attachment->isprivate, - type => CMT_ATTACHMENT_UPDATED, - extra_data => $attachment->id, - is_markdown => Bugzilla->params->{use_markdown} ? 1 : 0 + isprivate => $attachment->isprivate, + type => CMT_ATTACHMENT_UPDATED, + extra_data => $attachment->id, + is_markdown => $is_markdown, } ); } diff --git a/extensions/BMO/template/en/default/hook/attachment/edit-view.html.tmpl b/extensions/BMO/template/en/default/hook/attachment/edit-view.html.tmpl index e28a142ae..52b369106 100644 --- a/extensions/BMO/template/en/default/hook/attachment/edit-view.html.tmpl +++ b/extensions/BMO/template/en/default/hook/attachment/edit-view.html.tmpl @@ -21,6 +21,7 @@ [% attachment_data = attachment.fetch_github_pr_diff %]
+ [% INCLUDE global/textarea.html.tmpl id = 'editFrame' name = 'comment' diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl index 9bec35442..13f143eeb 100644 --- a/template/en/default/attachment/edit.html.tmpl +++ b/template/en/default/attachment/edit.html.tmpl @@ -179,6 +179,7 @@ [% Hook.process('view') %] [% UNLESS custom_attachment_viewer %]
+ [% INCLUDE global/textarea.html.tmpl id = 'editFrame' name = 'comment' -- 2.47.3