prevent corrupt notifications without notice_id
This commit is contained in:
parent
15daae0a36
commit
bbbbfb2920
|
@ -631,7 +631,7 @@ class QvitterPlugin extends Plugin {
|
||||||
if($notice->reply_to) {
|
if($notice->reply_to) {
|
||||||
$replyparent = $notice->getParent();
|
$replyparent = $notice->getParent();
|
||||||
$replyauthor = $replyparent->getProfile();
|
$replyauthor = $replyparent->getProfile();
|
||||||
if ($replyauthor instanceof Profile) {
|
if ($replyauthor instanceof Profile && !empty($notice->id)) {
|
||||||
$reply_notification_to = $replyauthor->id;
|
$reply_notification_to = $replyauthor->id;
|
||||||
$this->insertNotification($replyauthor->id, $notice->profile_id, 'reply', $notice->id);
|
$this->insertNotification($replyauthor->id, $notice->profile_id, 'reply', $notice->id);
|
||||||
}
|
}
|
||||||
|
@ -650,7 +650,7 @@ class QvitterPlugin extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
// only notify if mentioned user is not already notified for reply
|
// only notify if mentioned user is not already notified for reply
|
||||||
if($reply_notification_to != $mentioned->id) {
|
if($reply_notification_to != $mentioned->id && !empty($notice->id)) {
|
||||||
$this->insertNotification($mentioned->id, $notice->profile_id, 'mention', $notice->id);
|
$this->insertNotification($mentioned->id, $notice->profile_id, 'mention', $notice->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ class ApiNewNotificationsAction extends ApiAction
|
||||||
$notification->whereAdd("(to_profile_id = '".$user_id."')");
|
$notification->whereAdd("(to_profile_id = '".$user_id."')");
|
||||||
$notification->groupBy('ntype');
|
$notification->groupBy('ntype');
|
||||||
$notification->whereAdd("(is_seen = '0')");
|
$notification->whereAdd("(is_seen = '0')");
|
||||||
|
$notification->whereAdd("(notice_id != 'NULL')"); // sometimes notice_id is NULL, those notifications are corrupt and should be discarded
|
||||||
$notification->find();
|
$notification->find();
|
||||||
|
|
||||||
while ($notification->fetch()) {
|
while ($notification->fetch()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user