Use array_unique

2022.09-rc
Michael 2020-09-06 20:09:29 +00:00
rodzic d332272d55
commit 0684922ec2
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -69,14 +69,14 @@ class UserItem
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0 INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0
WHERE `parent` IN (SELECT `parent` FROM `item` WHERE `id`=?)", $iid); WHERE `parent` IN (SELECT `parent` FROM `item` WHERE `id`=?)", $iid);
while ($user = DBA::fetch($users)) { while ($user = DBA::fetch($users)) {
$uids[$user['uid']] = $user['uid']; $uids[] = $user['uid'];
} }
DBA::close($users); DBA::close($users);
// Add item users // Add item users
$users = Item::select(['uid'], ["`parent-uri-id` = ? AND `uid` != ?", $item['parent-uri-id'], 0], ['group_by' => ['uid']]); $users = Item::select(['uid'], ["`parent-uri-id` = ? AND `uid` != ?", $item['parent-uri-id'], 0], ['group_by' => ['uid']]);
while ($user = DBA::fetch($users)) { while ($user = DBA::fetch($users)) {
$uids[$user['uid']] = $user['uid']; $uids[] = $user['uid'];
} }
DBA::close($users); DBA::close($users);
@ -86,12 +86,12 @@ class UserItem
foreach ($mentions as $mention) { foreach ($mentions as $mention) {
$uid = User::getIdForURL($mention['url']); $uid = User::getIdForURL($mention['url']);
if (!empty($uid)) { if (!empty($uid)) {
$uids[$uid] = $uid; $uids[] = $uid;
} }
} }
} }
foreach ($uids as $uid) { foreach (array_unique($uids) as $uid) {
self::setNotificationForUser($item, $uid); self::setNotificationForUser($item, $uid);
} }
} }