Skip to content

Commit 79679c5

Browse files
author
RedEnchilada
committed
Make Notifications plugin delete orphaned note entries
1 parent 62f37f3 commit 79679c5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugins/Notification/User_notification.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ static function getAllForUser($user) {
9393
$item['created'] = $notify->created;
9494

9595
$other = Profile::staticGet('id', $notify->from_user_id);
96-
if($other == false)
96+
if($other == false) {
97+
$notify->delete();
9798
continue;
99+
}
98100
$item['user'] = array(
99101
'id' => $other->id,
100102
'nickname' => $other->nickname,
@@ -108,6 +110,7 @@ static function getAllForUser($user) {
108110
$notice = Notice::staticGet('id', $notify->arg);
109111
if($notice == false) {
110112
$item = null;
113+
$notify->delete();
111114
break;
112115
}
113116
$item['notice'] = array(
@@ -123,6 +126,7 @@ static function getAllForUser($user) {
123126
$notice = Notice::staticGet('id', $notify->arg2);
124127
if($notice == false) {
125128
$item = null;
129+
$notify->delete();
126130
break;
127131
}
128132
$item['notice'] = array(
@@ -137,6 +141,7 @@ static function getAllForUser($user) {
137141
$group = User_group::staticGet('id', $notify->arg);
138142
if($group == false) {
139143
$item = null;
144+
$notify->delete();
140145
break;
141146
}
142147
$item['group'] = array(

0 commit comments

Comments
 (0)