Merge pull request #6469 from annando/diaspora-priority

Avoid that forum posts are received via the Diaspora protocol first
This commit is contained in:
Hypolite Petovan 2019-01-19 08:08:28 -05:00 committed by GitHub
commit 906f7b5698
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -436,8 +436,9 @@ class Notifier
// The function will ensure that there are no duplicates // The function will ensure that there are no duplicates
$r1 = Diaspora::participantsForThread($item_id, $r1); $r1 = Diaspora::participantsForThread($item_id, $r1);
// Add the relay to the list, avoid duplicates // Add the relay to the list, avoid duplicates.
if (!$followup) { // Don't send community posts to the relay. Forum posts via the Diaspora protocol are looking ugly.
if (!$followup && !self::isForumPost($target_item, $owner)) {
$r1 = Diaspora::relayList($item_id, $r1); $r1 = Diaspora::relayList($item_id, $r1);
} }
} }
@ -453,8 +454,16 @@ class Notifier
foreach ($r as $rr) { foreach ($r as $rr) {
$conversants[] = $rr['id']; $conversants[] = $rr['id'];
Logger::log('Public delivery of item ' . $target_item["guid"] . ' (' . $item_id . ') to ' . json_encode($rr), Logger::DEBUG); Logger::log('Public delivery of item ' . $target_item["guid"] . ' (' . $item_id . ') to ' . json_encode($rr), Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Delivery', $cmd, $item_id, (int)$rr['id']); // Ensure that posts with our own protocol arrives before Diaspora posts arrive.
// Situation is that sometimes Friendica servers receive Friendica posts over the Diaspora protocol first.
// The conversion in Markdown reduces the formatting, so these posts should arrive after the Friendica posts.
if ($rr['network'] == Protocol::DIASPORA) {
$deliver_options = ['priority' => $a->queue['priority'], 'dont_fork' => true];
} else {
$deliver_options = ['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true];
}
Worker::add($deliver_options, 'Delivery', $cmd, $item_id, (int)$rr['id']);
} }
} }
@ -477,8 +486,16 @@ class Notifier
} }
Logger::log('Delivery of item ' . $item_id . ' to ' . json_encode($contact), Logger::DEBUG); Logger::log('Delivery of item ' . $item_id . ' to ' . json_encode($contact), Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Delivery', $cmd, $item_id, (int)$contact['id']); // Ensure that posts with our own protocol arrives before Diaspora posts arrive.
// Situation is that sometimes Friendica servers receive Friendica posts over the Diaspora protocol first.
// The conversion in Markdown reduces the formatting, so these posts should arrive after the Friendica posts.
if ($contact['network'] == Protocol::DIASPORA) {
$deliver_options = ['priority' => $a->queue['priority'], 'dont_fork' => true];
} else {
$deliver_options = ['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true];
}
Worker::add($deliver_options, 'Delivery', $cmd, $item_id, (int)$contact['id']);
} }
} }