Merge pull request #5709 from annando/issue-5262

Issue 5262: Comments to a forum post aren't distributed via push
2022.09-rc
Hypolite Petovan 2018-09-01 00:14:05 -04:00 zatwierdzone przez GitHub
commit 61168ccb65
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 28 dodań i 17 usunięć

Wyświetl plik

@ -217,24 +217,16 @@ class Notifier
}
// Special treatment for forum posts
if (($target_item['author-id'] != $target_item['owner-id']) &&
($owner['id'] != $target_item['contact-id']) &&
($target_item['uri'] === $target_item['parent-uri'])) {
$fields = ['forum', 'prv'];
$condition = ['id' => $target_item['contact-id']];
$contact = DBA::selectFirst('contact', $fields, $condition);
if (!DBA::isResult($contact)) {
// Should never happen
return false;
}
// Is the post from a forum?
if ($contact['forum'] || $contact['prv']) {
$relay_to_owner = true;
$direct_forum_delivery = true;
}
if (self::isForumPost($target_item, $owner)) {
$relay_to_owner = true;
$direct_forum_delivery = true;
}
// Avoid that comments in a forum thread are sent to OStatus
if (self::isForumPost($parent, $owner)) {
$direct_forum_delivery = true;
}
if ($relay_to_owner) {
// local followup to remote post
$followup = true;
@ -504,4 +496,23 @@ class Notifier
return;
}
private static function isForumPost($item, $owner) {
if (($item['author-id'] == $item['owner-id']) ||
($owner['id'] == $item['contact-id']) ||
($item['uri'] != $item['parent-uri'])) {
return false;
}
$fields = ['forum', 'prv'];
$condition = ['id' => $item['contact-id']];
$contact = DBA::selectFirst('contact', $fields, $condition);
if (!DBA::isResult($contact)) {
// Should never happen
return false;
}
// Is the post from a forum?
return ($contact['forum'] || $contact['prv']);
}
}