From 1f5404213d4b93ef573e99112536ed5af6643770 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 28 Oct 2014 03:01:01 +0000 Subject: Bug 1059684: markdown text should not be rendered within a
 tag
 r=glob,a=glob

---
 Bugzilla/User.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'Bugzilla/User.pm')

diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index acedc65f2..fa2674366 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -632,6 +632,14 @@ sub is_bug_ignored {
     return (grep {$_->{'id'} == $bug_id} @{$self->bugs_ignored}) ? 1 : 0;
 }
 
+sub use_markdown {
+    my ($self, $comment) = @_;
+    return Bugzilla->feature('markdown')
+           && $self->settings->{use_markdown}->{is_enabled}
+           && $self->settings->{use_markdown}->{value} eq 'on'
+           && (!defined $comment || $comment->is_markdown);
+}
+
 ##########################
 # Saved Recent Bug Lists #
 ##########################
@@ -2623,6 +2631,12 @@ C The current summary of the bug.
 Returns true if the user does not want email notifications for the
 specified bug ID, else returns false.
 
+=item C
+
+Returns true if the user has set their preferences to use Markdown
+for rendering comments. If an optional C object is passed
+then it returns true if the comment has markdown enabled.
+
 =back
 
 =head2 Saved Recent Bug Lists
-- 
cgit v1.2.3-24-g4f1b