Issue 7613: When an item is deleted, delete all notifications for it
This commit is contained in:
parent
010a7b7576
commit
a6c72a209e
|
@ -1083,6 +1083,9 @@ class Item extends BaseObject
|
||||||
// "Deleting" global items just means hiding them
|
// "Deleting" global items just means hiding them
|
||||||
if ($item['uid'] == 0) {
|
if ($item['uid'] == 0) {
|
||||||
DBA::update('user-item', ['hidden' => true], ['iid' => $item['id'], 'uid' => $uid], true);
|
DBA::update('user-item', ['hidden' => true], ['iid' => $item['id'], 'uid' => $uid], true);
|
||||||
|
|
||||||
|
// Delete notifications
|
||||||
|
DBA::delete('notify', ['iid' => $item['id'], 'uid' => $uid]);
|
||||||
} elseif ($item['uid'] == $uid) {
|
} elseif ($item['uid'] == $uid) {
|
||||||
self::deleteById($item['id'], PRIORITY_HIGH);
|
self::deleteById($item['id'], PRIORITY_HIGH);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1173,6 +1176,9 @@ class Item extends BaseObject
|
||||||
// Delete tags that had been attached to other items
|
// Delete tags that had been attached to other items
|
||||||
self::deleteTagsFromItem($item);
|
self::deleteTagsFromItem($item);
|
||||||
|
|
||||||
|
// Delete notifications
|
||||||
|
DBA::delete('notify', ['iid' => $item['id'], 'uid' => $item['uid']]);
|
||||||
|
|
||||||
// Set the item to "deleted"
|
// Set the item to "deleted"
|
||||||
$item_fields = ['deleted' => true, 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()];
|
$item_fields = ['deleted' => true, 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()];
|
||||||
DBA::update('item', $item_fields, ['id' => $item['id']]);
|
DBA::update('item', $item_fields, ['id' => $item['id']]);
|
||||||
|
|
Loading…
Reference in a new issue