mirror of
https://github.com/friendica/friendica
synced 2025-04-29 00:24:24 +02:00
Relay: Avoid sending relay posts to servers that already received content
This commit is contained in:
parent
9d5abaca1c
commit
edcf1466a7
2 changed files with 29 additions and 22 deletions
|
@ -479,15 +479,9 @@ class Notifier {
|
|||
|
||||
|
||||
if ($public_message) {
|
||||
|
||||
$r0 = [];
|
||||
$r1 = [];
|
||||
|
||||
if ($diaspora_delivery) {
|
||||
if (!$followup) {
|
||||
$r0 = Diaspora::relayList($item_id);
|
||||
}
|
||||
|
||||
$r1 = q("SELECT `batch`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`
|
||||
FROM `contact` WHERE `network` = '%s' AND `batch` != ''
|
||||
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`",
|
||||
|
@ -500,17 +494,17 @@ class Notifier {
|
|||
// The function will ensure that there are no duplicates
|
||||
$r1 = Diaspora::participantsForThread($item_id, $r1);
|
||||
|
||||
// Add the relay to the list, avoid duplicates
|
||||
if (!$followup) {
|
||||
$r1 = Diaspora::relayList($item_id, $r1);
|
||||
}
|
||||
}
|
||||
|
||||
$r2 = q("SELECT `id`, `name`,`network` FROM `contact`
|
||||
WHERE `network` in ('%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d",
|
||||
dbesc(NETWORK_DFRN),
|
||||
intval($owner['uid']),
|
||||
intval(CONTACT_IS_SHARING)
|
||||
);
|
||||
$condition = ['network' => NETWORK_DFRN, 'uid' => $owner['uid'], 'blocked' => false,
|
||||
'pending' => false, 'archive' => false, 'rel' => [CONTACT_IS_FOLLOWER, CONTACT_IS_FRIEND]];
|
||||
$r2 = dba::inArray(dba::select('contact', ['id', 'name', 'network'], $condition));
|
||||
|
||||
|
||||
$r = array_merge($r2, $r1, $r0);
|
||||
$r = array_merge($r2, $r1);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue