Improve forum delivery, avoid false distribution
This commit is contained in:
parent
3fd5c79025
commit
038e505ca3
|
@ -663,13 +663,14 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($actor)) {
|
if (!empty($actor)) {
|
||||||
$profile = APContact::getByURL($actor);
|
$profile = APContact::getByURL($actor);
|
||||||
$followers = $profile['followers'] ?? '';
|
$followers = $profile['followers'] ?? '';
|
||||||
|
$is_forum = $actor['type'] == 'Group';
|
||||||
Logger::log('Actor: ' . $actor . ' - Followers: ' . $followers, Logger::DEBUG);
|
Logger::info('Got actor and followers', ['actor' => $actor, 'followers' => $followers]);
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Empty actor', ['activity' => $activity]);
|
Logger::info('Empty actor', ['activity' => $activity]);
|
||||||
$followers = '';
|
$followers = '';
|
||||||
|
$is_forum = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to prevent false follower assumptions upon thread completions
|
// We have to prevent false follower assumptions upon thread completions
|
||||||
|
@ -692,7 +693,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch the receivers for the public and the followers collection
|
// Fetch the receivers for the public and the followers collection
|
||||||
if (in_array($receiver, [$followers, self::PUBLIC_COLLECTION]) && !empty($actor)) {
|
if ((($receiver == $followers) || (($receiver == self::PUBLIC_COLLECTION) && !$is_forum)) && !empty($actor)) {
|
||||||
$receivers = self::getReceiverForActor($actor, $tags, $receivers, $follower_target);
|
$receivers = self::getReceiverForActor($actor, $tags, $receivers, $follower_target);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Protocol\Relay;
|
use Friendica\Protocol\Relay;
|
||||||
use Friendica\Protocol\Salmon;
|
use Friendica\Protocol\Salmon;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The notifier is typically called with:
|
* The notifier is typically called with:
|
||||||
|
@ -249,6 +250,20 @@ class Notifier
|
||||||
$direct_forum_delivery = true;
|
$direct_forum_delivery = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$exclusive_delivery = false;
|
||||||
|
|
||||||
|
$exclusive_targets = Tag::getByURIId($parent['uri-id'], [Tag::EXCLUSIVE_MENTION]);
|
||||||
|
if (!empty($exclusive_targets)) {
|
||||||
|
$exclusive_delivery = true;
|
||||||
|
Logger::info('Possible Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id']]);
|
||||||
|
foreach ($exclusive_targets as $target) {
|
||||||
|
if (Strings::compareLink($owner['url'], $target['url'])) {
|
||||||
|
$exclusive_delivery = false;
|
||||||
|
Logger::info('False Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($relay_to_owner) {
|
if ($relay_to_owner) {
|
||||||
// local followup to remote post
|
// local followup to remote post
|
||||||
$followup = true;
|
$followup = true;
|
||||||
|
@ -283,14 +298,14 @@ class Notifier
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::log('Notify ' . $target_item["guid"] .' via PuSH: ' . ($push_notify ? "Yes":"No"), Logger::DEBUG);
|
Logger::log('Notify ' . $target_item["guid"] .' via PuSH: ' . ($push_notify ? "Yes":"No"), Logger::DEBUG);
|
||||||
} elseif ($targets = Tag::getByURIId($target_item['uri-id'], [Tag::EXCLUSIVE_MENTION])) {
|
} elseif ($exclusive_delivery) {
|
||||||
$followup = true;
|
$followup = true;
|
||||||
|
|
||||||
foreach ($targets as $target) {
|
foreach ($exclusive_targets as $target) {
|
||||||
$cid = Contact::getIdForURL($target['url'], $uid, false);
|
$cid = Contact::getIdForURL($target['url'], $uid, false);
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$recipients_followup[] = $cid;
|
$recipients_followup[] = $cid;
|
||||||
Logger::info('Exclusively delivering', ['guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]);
|
Logger::info('Exclusively delivering', ['uid' => $target_item['uid'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'url' => $target['url']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user