From 460ae51fc0e70dd2d7fcef4bdb92308269327f1d Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Fri, 9 Aug 2013 13:55:53 -0400 Subject: Bug 903514 - Backport upstream bug 569177 for etag support to bmo/4.2 --- Bugzilla/WebService/Bug.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Bugzilla/WebService/Bug.pm') diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index a07196209..df9084210 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -350,6 +350,18 @@ sub get { push(@bugs, $self->_bug_to_hash($bug, $params)); } + # Set the ETag before inserting the update tokens + # since the tokens will always be unique even if + # 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); + } + } + return { bugs => \@bugs, faults => \@faults }; } @@ -1008,11 +1020,6 @@ sub _bug_to_hash { $item{'actual_time'} = $self->type('double', $bug->actual_time); } - if (Bugzilla->user->id) { - my $token = issue_hash_token([$bug->id, $bug->delta_ts]); - $item{'update_token'} = $self->type('string', $token); - } - # The "accessible" bits go here because they have long names and it # makes the code look nicer to separate them out. $item{'is_cc_accessible'} = $self->type('boolean', -- cgit v1.2.3-24-g4f1b