mirror of
https://github.com/friendica/friendica
synced 2024-11-10 06:22:53 +00:00
Fix notifications for wrong users
This commit is contained in:
parent
e92904c3f3
commit
2a0635185a
1 changed files with 9 additions and 20 deletions
|
@ -63,8 +63,15 @@ class UserItem
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch all users in the thread
|
if ($item['uid'] == 0) {
|
||||||
$uids = [];
|
$uids = [];
|
||||||
|
} else {
|
||||||
|
// Always include the item user
|
||||||
|
$uids = [$item['uid']];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add every user who participated so far in this thread
|
||||||
|
// This can only happen with participations on global items. (means: uid = 0)
|
||||||
$users = DBA::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
|
$users = DBA::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
|
||||||
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);
|
||||||
|
@ -73,24 +80,6 @@ class UserItem
|
||||||
}
|
}
|
||||||
DBA::close($users);
|
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'];
|
|
||||||
}
|
|
||||||
DBA::close($users);
|
|
||||||
|
|
||||||
// Check for mentions to local users
|
|
||||||
if (in_array($item['private'], [Item::PUBLIC, Item::UNLISTED])) {
|
|
||||||
$mentions = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
|
|
||||||
foreach ($mentions as $mention) {
|
|
||||||
$uid = User::getIdForURL($mention['url']);
|
|
||||||
if (!empty($uid)) {
|
|
||||||
$uids[] = $uid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (array_unique($uids) as $uid) {
|
foreach (array_unique($uids) as $uid) {
|
||||||
self::setNotificationForUser($item, $uid);
|
self::setNotificationForUser($item, $uid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue