Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
cd3b8b48
Commit
cd3b8b48
authored
Oct 16, 2014
by
Koosha KM
Committed by
David Lawrence
Oct 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1080840: Update WebServices to include Markdown feature
r=dkl,a=glob
parent
94ffb7a9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
4 deletions
+98
-4
Bug.pm
Bugzilla/WebService/Bug.pm
+94
-4
Constants.pm
Bugzilla/WebService/Constants.pm
+1
-0
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+3
-0
No files found.
Bugzilla/WebService/Bug.pm
View file @
cd3b8b48
...
@@ -358,6 +358,7 @@ sub _translate_comment {
...
@@ -358,6 +358,7 @@ sub _translate_comment {
time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
creation_time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
creation_time
=>
$self
->
type
(
'dateTime'
,
$comment
->
creation_ts
),
is_private
=>
$self
->
type
(
'boolean'
,
$comment
->
is_private
),
is_private
=>
$self
->
type
(
'boolean'
,
$comment
->
is_private
),
is_markdown
=>
$self
->
type
(
'boolean'
,
$comment
->
is_markdown
),
text
=>
$self
->
type
(
'string'
,
$comment
->
body_full
),
text
=>
$self
->
type
(
'string'
,
$comment
->
body_full
),
attachment_id
=>
$self
->
type
(
'int'
,
$attach_id
),
attachment_id
=>
$self
->
type
(
'int'
,
$attach_id
),
count
=>
$self
->
type
(
'int'
,
$comment
->
count
),
count
=>
$self
->
type
(
'int'
,
$comment
->
count
),
...
@@ -824,8 +825,18 @@ sub add_attachment {
...
@@ -824,8 +825,18 @@ sub add_attachment {
$attachment
->
update
(
$timestamp
);
$attachment
->
update
(
$timestamp
);
my
$comment
=
$params
->
{
comment
}
||
''
;
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
,
$attachment
->
bug
->
add_comment
(
$comment
,
{
isprivate
=>
$attachment
->
isprivate
,
{
is_markdown
=>
$is_markdown
,
isprivate
=>
$attachment
->
isprivate
,
type
=>
CMT_ATTACHMENT_CREATED
,
type
=>
CMT_ATTACHMENT_CREATED
,
extra_data
=>
$attachment
->
id
});
extra_data
=>
$attachment
->
id
});
push
(
@created
,
$attachment
);
push
(
@created
,
$attachment
);
...
@@ -873,6 +884,14 @@ sub update_attachment {
...
@@ -873,6 +884,14 @@ sub update_attachment {
my
$flags
=
delete
$params
->
{
flags
};
my
$flags
=
delete
$params
->
{
flags
};
my
$comment
=
delete
$params
->
{
comment
};
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
# Update the values
foreach
my
$attachment
(
@attachments
)
{
foreach
my
$attachment
(
@attachments
)
{
...
@@ -892,7 +911,8 @@ sub update_attachment {
...
@@ -892,7 +911,8 @@ sub update_attachment {
if
(
$comment
=
trim
(
$comment
))
{
if
(
$comment
=
trim
(
$comment
))
{
$attachment
->
bug
->
add_comment
(
$comment
,
$attachment
->
bug
->
add_comment
(
$comment
,
{
isprivate
=>
$attachment
->
isprivate
,
{
is_markdown
=>
$is_markdown
,
isprivate
=>
$attachment
->
isprivate
,
type
=>
CMT_ATTACHMENT_UPDATED
,
type
=>
CMT_ATTACHMENT_UPDATED
,
extra_data
=>
$attachment
->
id
});
extra_data
=>
$attachment
->
id
});
}
}
...
@@ -951,8 +971,12 @@ sub add_comment {
...
@@ -951,8 +971,12 @@ sub add_comment {
if
(
defined
$params
->
{
private
})
{
if
(
defined
$params
->
{
private
})
{
$params
->
{
is_private
}
=
delete
$params
->
{
private
};
$params
->
{
is_private
}
=
delete
$params
->
{
private
};
}
}
ThrowUserError
(
'markdown_disabled'
)
if
$params
->
{
is_markdown
}
&&
!
_is_markdown_enabled
();
# Append comment
# Append comment
$bug
->
add_comment
(
$comment
,
{
isprivate
=>
$params
->
{
is_private
},
$bug
->
add_comment
(
$comment
,
{
isprivate
=>
$params
->
{
is_private
},
is_markdown
=>
$params
->
{
is_markdown
},
work_time
=>
$params
->
{
work_time
}
});
work_time
=>
$params
->
{
work_time
}
});
# Capture the call to bug->update (which creates the new comment) in
# Capture the call to bug->update (which creates the new comment) in
...
@@ -1401,6 +1425,14 @@ sub _add_update_tokens {
...
@@ -1401,6 +1425,14 @@ 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__
...
@@ -2078,6 +2110,10 @@ may be deprecated and removed in a future release.
...
@@ -2078,6 +2110,10 @@ may be deprecated and removed in a future release.
C<boolean> True if this comment is private (only visible to a certain
C<boolean> True if this comment is private (only visible to a certain
group called the "insidergroup"), False otherwise.
group called the "insidergroup"), False otherwise.
=item is_markdown
C<boolean> True if this comment needs Markdown processing, false otherwise.
=back
=back
=item B<Errors>
=item B<Errors>
...
@@ -3095,6 +3131,9 @@ don't want it to be assigned to the component owner.
...
@@ -3095,6 +3131,9 @@ don't want it to be assigned to the component owner.
=item C<comment_is_private> (boolean) - If set to true, the description
=item C<comment_is_private> (boolean) - If set to true, the description
is private, otherwise it is assumed to be public.
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
=item C<groups> (array) - An array of group names to put this
bug into. You can see valid group names on the Permissions
bug into. You can see valid group names on the Permissions
tab of the Preferences screen, or, if you are an administrator,
tab of the Preferences screen, or, if you are an administrator,
...
@@ -3250,6 +3289,8 @@ Bugzilla B<4.4>.
...
@@ -3250,6 +3289,8 @@ Bugzilla B<4.4>.
=item REST API call added in Bugzilla B<5.0>.
=item REST API call added in Bugzilla B<5.0>.
=item C<is_markdown> option added in Bugzilla B<5.0>.
=back
=back
=back
=back
...
@@ -3309,7 +3350,21 @@ C<text/plain> or C<image/png>.
...
@@ -3309,7 +3350,21 @@ C<text/plain> or C<image/png>.
=item C<comment>
=item C<comment>
C<string> A comment to add along with this attachment.
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
=item C<is_patch>
=item C<is_patch>
...
@@ -3387,6 +3442,10 @@ the type id value to update or add a flag.
...
@@ -3387,6 +3442,10 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
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)
=item 600 (Attachment Too Large)
You tried to attach a file that was larger than Bugzilla will accept.
You tried to attach a file that was larger than Bugzilla will accept.
...
@@ -3422,6 +3481,8 @@ You set the "data" field to an empty string.
...
@@ -3422,6 +3481,8 @@ You set the "data" field to an empty string.
=item REST API call added in Bugzilla B<5.0>.
=item REST API call added in Bugzilla B<5.0>.
=item C<is_markdown> added in Bugzilla B<5.0>.
=back
=back
=back
=back
...
@@ -3468,7 +3529,21 @@ attachment.
...
@@ -3468,7 +3529,21 @@ attachment.
=item C<comment>
=item C<comment>
C<string> An optional comment to add to the attachment's bug.
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
=item C<content_type>
=item C<content_type>
...
@@ -3617,6 +3692,11 @@ the type id value to update or add a flag.
...
@@ -3617,6 +3692,11 @@ the type id value to update or add a flag.
The flag type is inactive and cannot be used to create new flags.
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)
=item 601 (Invalid MIME Type)
You specified a C<content_type> argument that was blank, not a valid
You specified a C<content_type> argument that was blank, not a valid
...
@@ -3677,6 +3757,9 @@ you did not set the C<comment> parameter.
...
@@ -3677,6 +3757,9 @@ you did not set the C<comment> parameter.
=item C<is_private> (boolean) - If set to true, the comment is private,
=item C<is_private> (boolean) - If set to true, the comment is private,
otherwise it is assumed to be public.
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"
=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
on the bug. If you are not in the time tracking group, this value will
be ignored.
be ignored.
...
@@ -3718,6 +3801,11 @@ You tried to add a private comment, but don't have the necessary rights.
...
@@ -3718,6 +3801,11 @@ 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
You tried to add a comment longer than the maximum allowed length
(65,535 characters).
(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
=back
=item B<History>
=item B<History>
...
@@ -3740,6 +3828,8 @@ code of 32000.
...
@@ -3740,6 +3828,8 @@ code of 32000.
=item REST API call added in Bugzilla B<5.0>.
=item REST API call added in Bugzilla B<5.0>.
=item C<is_markdown> option added in Bugzilla B<5.0>.
=back
=back
=back
=back
...
...
Bugzilla/WebService/Constants.pm
View file @
cd3b8b48
...
@@ -101,6 +101,7 @@ use constant WS_ERROR_CODE => {
...
@@ -101,6 +101,7 @@ use constant WS_ERROR_CODE => {
comment_id_invalid
=>
111
,
comment_id_invalid
=>
111
,
comment_too_long
=>
114
,
comment_too_long
=>
114
,
comment_invalid_isprivate
=>
117
,
comment_invalid_isprivate
=>
117
,
markdown_disabled
=>
140
,
# Comment tagging
# Comment tagging
comment_tag_disabled
=>
125
,
comment_tag_disabled
=>
125
,
comment_tag_invalid
=>
126
,
comment_tag_invalid
=>
126
,
...
...
template/en/default/global/user-error.html.tmpl
View file @
cd3b8b48
...
@@ -1186,6 +1186,9 @@
...
@@ -1186,6 +1186,9 @@
[%# Used for non-web-based LOGIN_REQUIRED situations. %]
[%# Used for non-web-based LOGIN_REQUIRED situations. %]
You must log in before using this part of [% terms.Bugzilla %].
You must log in before using this part of [% terms.Bugzilla %].
[% ELSIF error == "markdown_disabled" %]
Markdown feature is not enabled.
[% ELSIF error == "migrate_config_created" %]
[% ELSIF error == "migrate_config_created" %]
The file <kbd>[% file FILTER html %]</kbd> contains configuration
The file <kbd>[% file FILTER html %]</kbd> contains configuration
variables that must be set before continuing with the migration.
variables that must be set before continuing with the migration.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment