summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-03-31 17:59:44 +0200
committerDavid Lawrence <dkl@mozilla.com>2014-03-31 17:59:44 +0200
commit16044938901286d9f2e9d4e2b3e91b16eba73284 (patch)
tree2e60008b856ca05852e048ffc1e84392cd538add
parent71927e7ee069c33019780158670df2415ee1ef3b (diff)
downloadbugzilla-16044938901286d9f2e9d4e2b3e91b16eba73284.tar.gz
bugzilla-16044938901286d9f2e9d4e2b3e91b16eba73284.tar.xz
Bug 990070 - backport bug 989647 to bmo/4.2 to allow Bug.update_attachment to add a comment when updating attachment details similar to attachment.cgi
-rw-r--r--Bugzilla/WebService/Bug.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index ef3b14f63..0ca4e8eac 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -917,6 +917,7 @@ sub update_attachment {
}
my $flags = delete $params->{flags};
+ my $comment = delete $params->{comment};
# Update the values
foreach my $attachment (@attachments) {
@@ -934,6 +935,13 @@ sub update_attachment {
foreach my $attachment (@attachments) {
my $changes = $attachment->update();
+ if ($comment = trim($comment)) {
+ $attachment->bug->add_comment($comment,
+ { isprivate => $attachment->isprivate,
+ type => CMT_ATTACHMENT_UPDATED,
+ extra_data => $attachment->id });
+ }
+
$changes = translate($changes, ATTACHMENT_MAPPED_RETURNS);
my %hash = (
@@ -961,7 +969,8 @@ sub update_attachment {
# Email users about the change
foreach my $bug (values %bugs) {
- Bugzilla::BugMail::Send($bug->id, { 'changer' => $user });
+ $bug->update();
+ $bug->send_changes();
}
# Return the information to the user
@@ -3605,6 +3614,10 @@ in the UI for this attachment.
C<string> A short string describing the
attachment.
+=item C<comment>
+
+C<string> An optional comment to add to the attachment's bug.
+
=item C<content_type>
C<string> The MIME type of the attachment, like