summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Hardison <dylan@mozilla.com>2016-03-09 22:18:17 +0100
committerDylan Hardison <dylan@mozilla.com>2016-03-09 22:18:17 +0100
commit6ec9ecf4f2c1fb32ffabc9758672317ff8847fee (patch)
treee842ed8a4bc77a461d283edac3bae7beaea8e407
parent30143b3262e3774d8618181cfae3100795fcbae2 (diff)
downloadbugzilla-6ec9ecf4f2c1fb32ffabc9758672317ff8847fee.tar.gz
bugzilla-6ec9ecf4f2c1fb32ffabc9758672317ff8847fee.tar.xz
Bug 1253483 - MozReview.attachments() doesn't create flags on new attachments
-rw-r--r--extensions/MozReview/lib/WebService.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/extensions/MozReview/lib/WebService.pm b/extensions/MozReview/lib/WebService.pm
index d814e05d6..24ae5cb5f 100644
--- a/extensions/MozReview/lib/WebService.pm
+++ b/extensions/MozReview/lib/WebService.pm
@@ -29,6 +29,7 @@ use constant PUBLIC_METHODS => qw( attachments );
BEGIN {
*_attachment_to_hash = \&Bugzilla::WebService::Bug::_attachment_to_hash;
+ *_flag_to_hash = \&Bugzilla::WebService::Bug::_flag_to_hash;
}
sub attachments {
@@ -154,6 +155,11 @@ sub attachments {
isprivate => $attachment->{is_private},
});
+ if ($flags) {
+ my ($old_flags, $new_flags) = extract_flags($flags, $bug, $attachment_obj);
+ $attachment_obj->set_flags($old_flags, $new_flags);
+ }
+
push(@created, $attachment_obj);
$attachment_obj->update($timestamp);
@@ -171,7 +177,7 @@ sub attachments {
$bug->send_changes();
my %attachments_created = map { $_->id => $self->_attachment_to_hash($_, $params) } @created;
- my %attachments_modified = map { $_->{id}->value => $_ } @modified;
+ my %attachments_modified = map { (ref $_->{id} ? $_->{id}->value : $_->{id}) => $_ } @modified;
return { attachments_created => \%attachments_created, attachments_modified => \%attachments_modified };
}