Skip to content

Commit 6ec9ecf

Browse files
author
Dylan Hardison
committed
Bug 1253483 - MozReview.attachments() doesn't create flags on new attachments
1 parent 30143b3 commit 6ec9ecf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

extensions/MozReview/lib/WebService.pm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use constant PUBLIC_METHODS => qw( attachments );
2929

3030
BEGIN {
3131
*_attachment_to_hash = \&Bugzilla::WebService::Bug::_attachment_to_hash;
32+
*_flag_to_hash = \&Bugzilla::WebService::Bug::_flag_to_hash;
3233
}
3334

3435
sub attachments {
@@ -154,6 +155,11 @@ sub attachments {
154155
isprivate => $attachment->{is_private},
155156
});
156157

158+
if ($flags) {
159+
my ($old_flags, $new_flags) = extract_flags($flags, $bug, $attachment_obj);
160+
$attachment_obj->set_flags($old_flags, $new_flags);
161+
}
162+
157163
push(@created, $attachment_obj);
158164

159165
$attachment_obj->update($timestamp);
@@ -171,7 +177,7 @@ sub attachments {
171177
$bug->send_changes();
172178

173179
my %attachments_created = map { $_->id => $self->_attachment_to_hash($_, $params) } @created;
174-
my %attachments_modified = map { $_->{id}->value => $_ } @modified;
180+
my %attachments_modified = map { (ref $_->{id} ? $_->{id}->value : $_->{id}) => $_ } @modified;
175181

176182
return { attachments_created => \%attachments_created, attachments_modified => \%attachments_modified };
177183
}

0 commit comments

Comments
 (0)