Commit 07f947c9 authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

Bug 556736: Make the bug_end_of_update hook also send $old_bug to the hook

r=mkanat, a=mkanat (module owner)
parent 2a444f9d
...@@ -865,10 +865,9 @@ sub update { ...@@ -865,10 +865,9 @@ sub update {
$changes->{'dup_id'} = [$old_dup || undef, $cur_dup || undef]; $changes->{'dup_id'} = [$old_dup || undef, $cur_dup || undef];
} }
Bugzilla::Hook::process('bug_end_of_update', { bug => $self, Bugzilla::Hook::process('bug_end_of_update',
timestamp => $delta_ts, { bug => $self, timestamp => $delta_ts, changes => $changes,
changes => $changes, old_bug => $old_bug });
});
# If any change occurred, refresh the timestamp of the bug. # If any change occurred, refresh the timestamp of the bug.
if (scalar(keys %$changes) || $self->{added_comments}) { if (scalar(keys %$changes) || $self->{added_comments}) {
......
...@@ -239,13 +239,22 @@ Params: ...@@ -239,13 +239,22 @@ Params:
=over =over
=item C<bug> - The changed bug object, with all fields set to their updated =item C<bug>
values.
=item C<timestamp> - The timestamp used for all updates in this transaction. The changed bug object, with all fields set to their updated values.
=item C<changes> - The hash of changed fields. =item C<old_bug>
C<$changes-E<gt>{field} = [old, new]>
A bug object pulled from the database before the fields were set to
their updated values (so it has the old values available for each field).
=item C<timestamp>
The timestamp used for all updates in this transaction.
=item C<changes>
The hash of changed fields. C<< $changes->{field} = [old, new] >>
=back =back
......
...@@ -119,13 +119,16 @@ sub bug_end_of_update { ...@@ -119,13 +119,16 @@ sub bug_end_of_update {
# This code doesn't actually *do* anything, it's just here to show you # This code doesn't actually *do* anything, it's just here to show you
# how to use this hook. # how to use this hook.
my ($bug, $timestamp, $changes) = @$args{qw(bug timestamp changes)}; my ($bug, $old_bug, $timestamp, $changes) =
@$args{qw(bug old_bug timestamp changes)};
foreach my $field (keys %$changes) { foreach my $field (keys %$changes) {
my $used_to_be = $changes->{$field}->[0]; my $used_to_be = $changes->{$field}->[0];
my $now_it_is = $changes->{$field}->[1]; my $now_it_is = $changes->{$field}->[1];
} }
my $old_summary = $old_bug->short_desc;
my $status_message; my $status_message;
if (my $status_change = $changes->{'bug_status'}) { if (my $status_change = $changes->{'bug_status'}) {
my $old_status = new Bugzilla::Status({ name => $status_change->[0] }); my $old_status = new Bugzilla::Status({ name => $status_change->[0] });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment