aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-11-04 21:46:41 +0000
committerDavid Lawrence <dkl@mozilla.com>2014-11-04 21:46:41 +0000
commitf5fc4a6d6bf930607d8dd5cd7ffeb78a1044918f (patch)
treeb95c7e398739df2b8447d93a32a1b10f2c9fc2e7 /Bugzilla/WebService
parentfc62fd4082c76068c2062f4e50b88c0908db2be2 (diff)
downloadbugs-f5fc4a6d6bf930607d8dd5cd7ffeb78a1044918f.tar
bugs-f5fc4a6d6bf930607d8dd5cd7ffeb78a1044918f.tar.gz
bugs-f5fc4a6d6bf930607d8dd5cd7ffeb78a1044918f.tar.bz2
bugs-f5fc4a6d6bf930607d8dd5cd7ffeb78a1044918f.tar.xz
bugs-f5fc4a6d6bf930607d8dd5cd7ffeb78a1044918f.zip
Revert Bug 330707 - Add optional support for MarkDown
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r--Bugzilla/WebService/Bug.pm130
-rw-r--r--Bugzilla/WebService/Constants.pm1
2 files changed, 19 insertions, 112 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index f50bb6aee..7c28b1d8d 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -331,9 +331,7 @@ sub render_comment {
Bugzilla->switch_to_shadow_db();
my $bug = $params->{id} ? Bugzilla::Bug->check($params->{id}) : undef;
- my $markdown = $params->{markdown} ? 1 : 0;
- my $tmpl = $markdown ? '[% text FILTER markdown(bug, { is_markdown => 1 }) %]' : '[% text FILTER markdown(bug) %]';
-
+ my $tmpl = '[% text FILTER quoteUrls(bug) %]';
my $html;
my $template = Bugzilla->template;
$template->process(
@@ -352,16 +350,15 @@ sub _translate_comment {
: undef;
my $comment_hash = {
- id => $self->type('int', $comment->id),
- bug_id => $self->type('int', $comment->bug_id),
- creator => $self->type('email', $comment->author->login),
- time => $self->type('dateTime', $comment->creation_ts),
+ id => $self->type('int', $comment->id),
+ bug_id => $self->type('int', $comment->bug_id),
+ creator => $self->type('email', $comment->author->login),
+ time => $self->type('dateTime', $comment->creation_ts),
creation_time => $self->type('dateTime', $comment->creation_ts),
- is_private => $self->type('boolean', $comment->is_private),
- is_markdown => $self->type('boolean', $comment->is_markdown),
- text => $self->type('string', $comment->body_full),
+ is_private => $self->type('boolean', $comment->is_private),
+ text => $self->type('string', $comment->body_full),
attachment_id => $self->type('int', $attach_id),
- count => $self->type('int', $comment->count),
+ count => $self->type('int', $comment->count),
};
# Don't load comment tags unless enabled
@@ -825,20 +822,10 @@ sub add_attachment {
$attachment->update($timestamp);
my $comment = $params->{comment} || '';
-
- my $is_markdown = 0;
- if (ref $params->{comment} eq 'HASH') {
- $is_markdown = $params->{comment}->{is_markdown};
- $comment = $params->{comment}->{body};
- }
-
- ThrowUserError('markdown_disabled') if $is_markdown && !_is_markdown_enabled();
-
- $attachment->bug->add_comment($comment,
- { is_markdown => $is_markdown,
- isprivate => $attachment->isprivate,
- type => CMT_ATTACHMENT_CREATED,
- extra_data => $attachment->id });
+ $attachment->bug->add_comment($comment,
+ { isprivate => $attachment->isprivate,
+ type => CMT_ATTACHMENT_CREATED,
+ extra_data => $attachment->id });
push(@created, $attachment);
}
$_->bug->update($timestamp) foreach @created;
@@ -884,14 +871,6 @@ sub update_attachment {
my $flags = delete $params->{flags};
my $comment = delete $params->{comment};
- my $is_markdown = 0;
-
- if (ref $comment eq 'HASH') {
- $is_markdown = $comment->{is_markdown};
- $comment = $comment->{body};
- }
-
- ThrowUserError('markdown_disabled') if $is_markdown && !_is_markdown_enabled();
# Update the values
foreach my $attachment (@attachments) {
@@ -911,10 +890,9 @@ sub update_attachment {
if ($comment = trim($comment)) {
$attachment->bug->add_comment($comment,
- { is_markdown => $is_markdown,
- isprivate => $attachment->isprivate,
- type => CMT_ATTACHMENT_UPDATED,
- extra_data => $attachment->id });
+ { isprivate => $attachment->isprivate,
+ type => CMT_ATTACHMENT_UPDATED,
+ extra_data => $attachment->id });
}
$changes = translate($changes, ATTACHMENT_MAPPED_RETURNS);
@@ -971,13 +949,9 @@ sub add_comment {
if (defined $params->{private}) {
$params->{is_private} = delete $params->{private};
}
-
- ThrowUserError('markdown_disabled') if $params->{is_markdown} && !_is_markdown_enabled();
-
# Append comment
- $bug->add_comment($comment, { isprivate => $params->{is_private},
- is_markdown => $params->{is_markdown},
- work_time => $params->{work_time} });
+ $bug->add_comment($comment, { isprivate => $params->{is_private},
+ work_time => $params->{work_time} });
# Capture the call to bug->update (which creates the new comment) in
# a transaction so we're sure to get the correct comment_id.
@@ -1425,14 +1399,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;
__END__
@@ -2110,10 +2076,6 @@ may be deprecated and removed in a future release.
C<boolean> True if this comment is private (only visible to a certain
group called the "insidergroup"), False otherwise.
-=item is_markdown
-
-C<boolean> True if this comment needs Markdown processing, false otherwise.
-
=back
=item B<Errors>
@@ -3131,9 +3093,6 @@ don't want it to be assigned to the component owner.
=item C<comment_is_private> (boolean) - If set to true, the description
is private, otherwise it is assumed to be public.
-=item C<is_markdown> (boolean) - If set to true, the description
-has Markdown structures, otherwise it is a normal text.
-
=item C<groups> (array) - An array of group names to put this
bug into. You can see valid group names on the Permissions
tab of the Preferences screen, or, if you are an administrator,
@@ -3289,8 +3248,6 @@ Bugzilla B<4.4>.
=item REST API call added in Bugzilla B<5.0>.
-=item C<is_markdown> option added in Bugzilla B<5.0>.
-
=back
=back
@@ -3350,21 +3307,7 @@ C<text/plain> or C<image/png>.
=item C<comment>
-C<string> or hash. A comment to add along with this attachment. If C<comment>
-is a hash, it has the following keys:
-
-=over
-
-=item C<body>
-
-C<string> The body of the comment.
-
-=item C<is_markdown>
-
-C<boolean> If set to true, the comment has Markdown structures; otherwise, it
-is an ordinary text.
-
-=back
+C<string> A comment to add along with this attachment.
=item C<is_patch>
@@ -3442,10 +3385,6 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
-=item 140 (Markdown Disabled)
-
-You tried to set the C<is_markdown> flag of the comment to true but the Markdown feature is not enabled.
-
=item 600 (Attachment Too Large)
You tried to attach a file that was larger than Bugzilla will accept.
@@ -3481,8 +3420,6 @@ You set the "data" field to an empty string.
=item REST API call added in Bugzilla B<5.0>.
-=item C<is_markdown> added in Bugzilla B<5.0>.
-
=back
=back
@@ -3529,21 +3466,7 @@ attachment.
=item C<comment>
-C<string> or hash: An optional comment to add to the attachment's bug. If C<comment> is
-a hash, it has the following keys:
-
-=over
-
-=item C<body>
-
-C<string> The body of the comment to be added.
-
-=item C<is_markdown>
-
-C<boolean> If set to true, the comment has Markdown structures; otherwise it is a normal
-text.
-
-=back
+C<string> An optional comment to add to the attachment's bug.
=item C<content_type>
@@ -3692,11 +3615,6 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
-=item 140 (Markdown Disabled)
-
-You tried to set the C<is_markdown> flag of the C<comment> to true but Markdown feature is
-not enabled.
-
=item 601 (Invalid MIME Type)
You specified a C<content_type> argument that was blank, not a valid
@@ -3757,9 +3675,6 @@ you did not set the C<comment> parameter.
=item C<is_private> (boolean) - If set to true, the comment is private,
otherwise it is assumed to be public.
-=item C<is_markdown> (boolean) - If set to true, the comment has Markdown
-structures, otherwise it is a normal text.
-
=item C<work_time> (double) - Adds this many hours to the "Hours Worked"
on the bug. If you are not in the time tracking group, this value will
be ignored.
@@ -3801,11 +3716,6 @@ You tried to add a private comment, but don't have the necessary rights.
You tried to add a comment longer than the maximum allowed length
(65,535 characters).
-=item 140 (Markdown Disabled)
-
-You tried to set the C<is_markdown> flag to true but the Markdown feature
-is not enabled.
-
=back
=item B<History>
@@ -3828,8 +3738,6 @@ code of 32000.
=item REST API call added in Bugzilla B<5.0>.
-=item C<is_markdown> option added in Bugzilla B<5.0>.
-
=back
=back
diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm
index db50611cb..d612ebc75 100644
--- a/Bugzilla/WebService/Constants.pm
+++ b/Bugzilla/WebService/Constants.pm
@@ -101,7 +101,6 @@ use constant WS_ERROR_CODE => {
comment_id_invalid => 111,
comment_too_long => 114,
comment_invalid_isprivate => 117,
- markdown_disabled => 140,
# Comment tagging
comment_tag_disabled => 125,
comment_tag_invalid => 126,