Commit 80285a18 authored by Koosha KM's avatar Koosha KM Committed by David Lawrence

Bug 1089820: Make use of User.use_markdown() defined in Bug 1059684

r=dkl,a=glob
parent 9925e7c7
...@@ -832,7 +832,8 @@ sub add_attachment { ...@@ -832,7 +832,8 @@ sub add_attachment {
$comment = $params->{comment}->{body}; $comment = $params->{comment}->{body};
} }
ThrowUserError('markdown_disabled') if $is_markdown && !_is_markdown_enabled(); ThrowUserError('markdown_disabled')
if $is_markdown && !Bugzilla->user->use_markdown();
$attachment->bug->add_comment($comment, $attachment->bug->add_comment($comment,
{ is_markdown => $is_markdown, { is_markdown => $is_markdown,
...@@ -891,7 +892,8 @@ sub update_attachment { ...@@ -891,7 +892,8 @@ sub update_attachment {
$comment = $comment->{body}; $comment = $comment->{body};
} }
ThrowUserError('markdown_disabled') if $is_markdown && !_is_markdown_enabled(); ThrowUserError('markdown_disabled')
if $is_markdown && !$user->use_markdown();
# Update the values # Update the values
foreach my $attachment (@attachments) { foreach my $attachment (@attachments) {
...@@ -972,7 +974,8 @@ sub add_comment { ...@@ -972,7 +974,8 @@ sub add_comment {
$params->{is_private} = delete $params->{private}; $params->{is_private} = delete $params->{private};
} }
ThrowUserError('markdown_disabled') if $params->{is_markdown} && !_is_markdown_enabled(); ThrowUserError('markdown_disabled')
if $params->{is_markdown} && !$user->use_markdown();
# Append comment # Append comment
$bug->add_comment($comment, { isprivate => $params->{is_private}, $bug->add_comment($comment, { isprivate => $params->{is_private},
...@@ -1425,14 +1428,6 @@ sub _add_update_tokens { ...@@ -1425,14 +1428,6 @@ sub _add_update_tokens {
} }
} }
sub _is_markdown_enabled {
my $user = Bugzilla->user;
return Bugzilla->feature('markdown')
&& $user->settings->{use_markdown}->{is_enabled}
&& $user->setting('use_markdown') eq 'on';
}
1; 1;
__END__ __END__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment