summaryrefslogtreecommitdiffstats
path: root/extensions/ZPushNotify
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-11-10 17:43:03 +0100
committerDavid Lawrence <dkl@mozilla.com>2014-11-10 17:43:03 +0100
commitc2533c1f2e7c5c4376eb0dae17c3380b04067678 (patch)
treee99e75084e43741926fba829497f03b2d1b1a017 /extensions/ZPushNotify
parent613e77099b334526dd0d4e73383231e8332f3816 (diff)
downloadbugzilla-c2533c1f2e7c5c4376eb0dae17c3380b04067678.tar.gz
bugzilla-c2533c1f2e7c5c4376eb0dae17c3380b04067678.tar.xz
Bug 1067619: Pulse is not notified of changes to attachment flags
Diffstat (limited to 'extensions/ZPushNotify')
-rw-r--r--extensions/ZPushNotify/Extension.pm35
1 files changed, 30 insertions, 5 deletions
diff --git a/extensions/ZPushNotify/Extension.pm b/extensions/ZPushNotify/Extension.pm
index 6e8ab4d27..e31380cfe 100644
--- a/extensions/ZPushNotify/Extension.pm
+++ b/extensions/ZPushNotify/Extension.pm
@@ -31,14 +31,38 @@ sub _notify {
# object hooks
#
-sub object_end_of_update {
+sub object_end_of_create {
+ my ($self, $args) = @_;
+ my $object = $args->{object};
+ return unless Bugzilla->params->{enable_simple_push};
+ return unless $object->isa('Bugzilla::Flag');
+ _notify($object->bug->id, $object->creation_date);
+}
+
+sub flag_updated {
+ my ($self, $args) = @_;
+ my $flag = $args->{flag};
+ my $timestamp = $args->{timestamp};
+ my $changes = $args->{changes};
+ return unless Bugzilla->params->{enable_simple_push};
+ return unless scalar(keys %$changes);
+ _notify($flag->bug->id, $timestamp);
+}
+
+sub flag_deleted {
+ my ($self, $args) = @_;
+ my $flag = $args->{flag};
+ my $timestamp = $args->{timestamp};
+ return unless Bugzilla->params->{enable_simple_push};
+ _notify($flag->bug->id, $timestamp);
+}
+
+sub attachment_end_of_update {
my ($self, $args) = @_;
return unless Bugzilla->params->{enable_simple_push};
return unless scalar keys %{ $args->{changes} };
return unless my $object = $args->{object};
- if ($object->isa('Bugzilla::Attachment')) {
- _notify($object->bug->id, $object->bug->delta_ts);
- }
+ _notify($object->bug->id, $object->modification_time);
}
sub object_before_delete {
@@ -46,7 +70,8 @@ sub object_before_delete {
return unless Bugzilla->params->{enable_simple_push};
return unless my $object = $args->{object};
if ($object->isa('Bugzilla::Attachment')) {
- _notify($object->bug->id, $object->bug->delta_ts);
+ my $timestamp = Bugzilla->dbh->selectrow_array('SELECT LOCALTIMESTAMP(0)');
+ _notify($object->bug->id, $timestamp);
}
}