From 0684922ec2426f91a4335ee298563eafaa8c2046 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 6 Sep 2020 20:09:29 +0000 Subject: [PATCH] Use array_unique --- src/Model/UserItem.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Model/UserItem.php b/src/Model/UserItem.php index be47ccf72..db73ab45f 100644 --- a/src/Model/UserItem.php +++ b/src/Model/UserItem.php @@ -69,14 +69,14 @@ class UserItem INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0 WHERE `parent` IN (SELECT `parent` FROM `item` WHERE `id`=?)", $iid); while ($user = DBA::fetch($users)) { - $uids[$user['uid']] = $user['uid']; + $uids[] = $user['uid']; } DBA::close($users); // Add item users $users = Item::select(['uid'], ["`parent-uri-id` = ? AND `uid` != ?", $item['parent-uri-id'], 0], ['group_by' => ['uid']]); while ($user = DBA::fetch($users)) { - $uids[$user['uid']] = $user['uid']; + $uids[] = $user['uid']; } DBA::close($users); @@ -86,12 +86,12 @@ class UserItem foreach ($mentions as $mention) { $uid = User::getIdForURL($mention['url']); if (!empty($uid)) { - $uids[$uid] = $uid; + $uids[] = $uid; } } } - foreach ($uids as $uid) { + foreach (array_unique($uids) as $uid) { self::setNotificationForUser($item, $uid); } }