Commit 4665dd4b authored by Peter Spicer's avatar Peter Spicer Committed by Robert Lyon

Bug 1837194: Notify plugins when a notification is deleted

behatnotneeded

Change-Id: Ife0d0351e012fc9eef5bc3c3fc535e64a628e96a
parent 76aea3bf
......@@ -111,6 +111,16 @@ else if ($delete) {
db_begin();
$countdeleted = 0;
$plugins = plugin_all_installed();
foreach ($plugins as $key => $plugin) {
$classname = generate_class_name($plugin->plugintype, $plugin->name);
safe_require($plugin->plugintype, $plugin->name);
if (!is_callable(array($classname, 'notification_delete'))) {
unset ($plugins[$key]);
}
}
foreach ($ids as $list => $idsperlist) {
if ('module_multirecipient_notification' === $list) {
delete_messages_mr($idsperlist, $USER->get('id'));
......@@ -147,6 +157,11 @@ else if ($delete) {
}
}
$countdeleted += ($ids) ? count($ids) : count($idsperlist);
foreach ($plugins as $plugin) {
$classname = generate_class_name($plugin->plugintype, $plugin->name);
call_static_method($classname, 'notification_delete', $idsperlist, $USER->get('id'), $list);
}
}
db_commit();
$message = get_string('deletednotifications1', 'activity', $countdeleted);
......
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