summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-10-29 20:56:59 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-10-29 20:56:59 +0100
commitfdf5f56c31d109c0f457f3f31c32a1efb7de8b91 (patch)
treec8fe728488f57d80af31175915bf0f6a93463eeb /Bugzilla/WebService
parent59978eb91cf371cecb0048d96bf7ad6fbc0a602f (diff)
downloadbugzilla-fdf5f56c31d109c0f457f3f31c32a1efb7de8b91.tar.gz
bugzilla-fdf5f56c31d109c0f457f3f31c32a1efb7de8b91.tar.xz
Bug 927497 - "Add me to CC list" feature of bug creation screen gives token error
Diffstat (limited to 'Bugzilla/WebService')
-rw-r--r--Bugzilla/WebService/Bug.pm28
1 files changed, 18 insertions, 10 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 1d084ee5c..0202afc59 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -348,8 +348,7 @@ sub get {
(defined $ids && scalar @$ids)
|| ThrowCodeError('param_required', { param => 'ids' });
- my @bugs;
- my @faults;
+ my (@bugs, @faults, @hashes);
# Cache permissions for bugs. This highly reduces the number of calls to the DB.
# visible_bugs() is only able to handle bug IDs, so we have to skip aliases.
@@ -373,7 +372,8 @@ sub get {
else {
$bug = Bugzilla::Bug->check($bug_id);
}
- push(@bugs, $self->_bug_to_hash($bug, $params));
+ push(@bugs, $bug);
+ push(@hashes, $self->_bug_to_hash($bug, $params));
}
# Set the ETag before inserting the update tokens
@@ -381,14 +381,9 @@ sub get {
# the data has not changed.
$self->bz_etag(\@bugs);
- if (Bugzilla->user->id) {
- foreach my $bug (@bugs) {
- my $token = issue_hash_token([$bug->{'id'}, $bug->{'last_change_time'}]);
- $bug->{'update_token'} = $self->type('string', $token);
- }
- }
+ $self->_add_update_tokens($params, \@bugs, \@hashes);
- return { bugs => \@bugs, faults => \@faults };
+ return { bugs => \@hashes, faults => \@faults };
}
# this is a function that gets bug activity for list of bug ids
@@ -583,6 +578,7 @@ sub possible_duplicates {
{ summary => $params->{summary}, products => \@products,
limit => $params->{limit} });
my @hashes = map { $self->_bug_to_hash($_, $params) } @$possible_dupes;
+ $self->_add_update_tokens($params, $possible_dupes, \@hashes);
return { bugs => \@hashes };
}
@@ -1244,6 +1240,18 @@ sub _flag_to_hash {
return $item;
}
+sub _add_update_tokens {
+ my ($self, $params, $bugs, $hashes) = @_;
+
+ return if !Bugzilla->user->id;
+ return if !filter_wants($params, 'update_token');
+
+ for(my $i = 0; $i < @$bugs; $i++) {
+ my $token = issue_hash_token([$bugs->[$i]->id, $bugs->[$i]->delta_ts]);
+ $hashes->[$i]->{'update_token'} = $self->type('string', $token);
+ }
+}
+
1;
__END__