summaryrefslogtreecommitdiff
path: root/modules/notification/helpers/notification_event.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/notification/helpers/notification_event.php')
-rw-r--r--modules/notification/helpers/notification_event.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php
index 3fccdfbe..df06a2f1 100644
--- a/modules/notification/helpers/notification_event.php
+++ b/modules/notification/helpers/notification_event.php
@@ -23,7 +23,9 @@ class notification_event_Core {
}
static function item_created($item) {
- notification::send_item_add($item);
+ if (!batch::in_progress("add")) {
+ notification::send_item_add($item);
+ }
}
static function item_before_delete($item) {
@@ -51,4 +53,24 @@ class notification_event_Core {
->where("user_id", $user->id)
->delete_all();
}
+
+ static function operation($name, $item) {
+ if ($name == "add") {
+ $id = Session::instance()->get("notification_batch_item_id");
+ if ($id && $item->id != $id) {
+ notification::send_batch_add($id);
+ }
+ Session::instance()->set("notification_batch_item_id", $item->id);
+ }
+ }
+
+ static function end_operation($name) {
+ if ($name == "add") {
+ $id = Session::instance()->get_once("notification_batch_item_id");
+ if ($id) {
+ notification::send_batch_add($id);
+ }
+ }
+ }
+
}