Skip to content

Commit

Permalink
Make Notifications plugin delete orphaned note entries
Browse files Browse the repository at this point in the history
  • Loading branch information
RedEnchilada committed Dec 20, 2014
1 parent 62f37f3 commit 79679c5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/Notification/User_notification.php
Expand Up @@ -93,8 +93,10 @@ static function getAllForUser($user) {
$item['created'] = $notify->created;

$other = Profile::staticGet('id', $notify->from_user_id);
if($other == false)
if($other == false) {
$notify->delete();
continue;
}
$item['user'] = array(
'id' => $other->id,
'nickname' => $other->nickname,
Expand All @@ -108,6 +110,7 @@ static function getAllForUser($user) {
$notice = Notice::staticGet('id', $notify->arg);
if($notice == false) {
$item = null;
$notify->delete();
break;
}
$item['notice'] = array(
Expand All @@ -123,6 +126,7 @@ static function getAllForUser($user) {
$notice = Notice::staticGet('id', $notify->arg2);
if($notice == false) {
$item = null;
$notify->delete();
break;
}
$item['notice'] = array(
Expand All @@ -137,6 +141,7 @@ static function getAllForUser($user) {
$group = User_group::staticGet('id', $notify->arg);
if($group == false) {
$item = null;
$notify->delete();
break;
}
$item['group'] = array(
Expand Down

0 comments on commit 79679c5

Please sign in to comment.