From c2c664517d170b7451d48c2ef183c7779a0985c3 Mon Sep 17 00:00:00 2001 From: Hannes Mannerheim Date: Tue, 19 May 2015 14:11:33 +0200 Subject: [PATCH] no duplicate mentions, thx @moshpirit #174 --- QvitterPlugin.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/QvitterPlugin.php b/QvitterPlugin.php index d1cbf09..d019161 100644 --- a/QvitterPlugin.php +++ b/QvitterPlugin.php @@ -674,9 +674,16 @@ class QvitterPlugin extends Plugin { // check for mentions to insert in notifications $mentions = common_find_mentions($notice->content, $notice); $sender = Profile::getKV($notice->profile_id); + $all_mentioned_user_ids = array(); foreach ($mentions as $mention) { foreach ($mention['mentioned'] as $mentioned) { - + + // no duplicate mentions + if(in_array($mentioned->id, $all_mentioned_user_ids)) { + continue; + } + $all_mentioned_user_ids[] = $mentioned->id; + // Not from blocked profile $mentioned_user = User::getKV('id', $mentioned->id); if ($mentioned_user instanceof User && $mentioned_user->hasBlocked($sender)) {