finally found a fix for #92

This commit is contained in:
Hannes Mannerheim 2015-06-16 20:20:28 +02:00
parent 492da05663
commit 80b9ca7fec

View File

@ -522,10 +522,16 @@ class QvitterPlugin extends Plugin {
function insertNotification($to_profile_id, $from_profile_id, $ntype, $notice_id=false)
{
// no notifications from blocked profiles
$to_user = User::getKV('id', $to_profile_id);
$from_user = Profile::getKV($from_profile_id);
if ($to_user instanceof User && $to_user->hasBlocked($from_user)) {
$from_profile = Profile::getKV($from_profile_id);
// don't notify remote profiles
if (!$to_user instanceof User) {
return false;
}
// no notifications from blocked profiles
if ($to_user->hasBlocked($from_profile)) {
return false;
}
@ -550,6 +556,7 @@ class QvitterPlugin extends Plugin {
}
/**
* Insert likes in notification table
*/
@ -631,22 +638,20 @@ class QvitterPlugin extends Plugin {
}
// check for mentions to insert in notifications
$mentions = common_find_mentions($notice->content, $notice);
$mentions = $notice->getReplies();
$sender = Profile::getKV($notice->profile_id);
$all_mentioned_user_ids = array();
foreach ($mentions as $mention) {
foreach ($mention['mentioned'] as $mentioned) {
foreach ($mentions as $mentioned) {
// no duplicate mentions
if(in_array($mentioned->id, $all_mentioned_user_ids)) {
continue;
}
$all_mentioned_user_ids[] = $mentioned->id;
// no duplicate mentions
if(in_array($mentioned, $all_mentioned_user_ids)) {
continue;
}
$all_mentioned_user_ids[] = $mentioned;
// only notify if mentioned user is not already notified for reply
if($reply_notification_to != $mentioned->id) {
$this->insertNotification($mentioned->id, $notice->profile_id, 'mention', $notice->id);
}
// only notify if mentioned user is not already notified for reply
if($reply_notification_to != $mentioned) {
$this->insertNotification($mentioned, $notice->profile_id, 'mention', $notice->id);
}
}
}