Issue 11513: Non public replies on public posts should now work

This commit is contained in:
Michael 2023-03-23 22:25:48 +00:00
parent 60c6ab08c1
commit df6cda8a4d
5 changed files with 27 additions and 16 deletions

View file

@ -863,11 +863,6 @@ class Processor
Logger::warning('Unknown parent item.', ['uri' => $parent_uri]);
return false;
}
if (!empty($activity['type']) && in_array($activity['type'], Receiver::CONTENT_TYPES) && ($item['private'] == Item::PRIVATE) && ($parent['private'] != Item::PRIVATE)) {
Logger::warning('Item is private but the parent is not. Dropping.', ['item-uri' => $item['uri'], 'thr-parent' => $item['thr-parent']]);
return false;
}
$content = self::removeImplicitMentionsFromBody($content, $parent);
}
$item['content-warning'] = HTML::toBBCode($activity['summary'] ?? '');

View file

@ -1085,14 +1085,6 @@ class Receiver
$reply[] = $object_id;
}
if (!empty($reply)) {
$parents = Post::select(['uid'], DBA::mergeConditions(['uri' => $reply], ["`uid` != ?", 0]));
while ($parent = Post::fetch($parents)) {
$receivers[$parent['uid']] = ['uid' => $parent['uid'], 'type' => self::TARGET_ANSWER];
}
DBA::close($parents);
}
if (!empty($actor)) {
$profile = APContact::getByURL($actor);
$followers = $profile['followers'] ?? '';
@ -1178,6 +1170,14 @@ class Receiver
}
}
if (!empty($reply) && (!empty($receivers[0]) || !empty($receivers[-1]))) {
$parents = Post::select(['uid'], DBA::mergeConditions(['uri' => $reply], ["`uid` != ?", 0]));
while ($parent = Post::fetch($parents)) {
$receivers[$parent['uid']] = ['uid' => $parent['uid'], 'type' => self::TARGET_ANSWER];
}
DBA::close($parents);
}
self::switchContacts($receivers, $actor);
// "birdsitelive" is a service that mirrors tweets into the fediverse

View file

@ -717,7 +717,12 @@ class Transmitter
}
if (!empty($item['parent'])) {
$parents = Post::select(['id', 'author-link', 'owner-link', 'gravity', 'uri'], ['parent' => $item['parent']], ['order' => ['id']]);
if ($item['private'] == Item::PRIVATE) {
$condition = ['parent' => $item['parent'], 'uri-id' => $item['thr-parent-id']];
} else {
$condition = ['parent' => $item['parent']];
}
$parents = Post::select(['id', 'author-link', 'owner-link', 'gravity', 'uri'], $condition, ['order' => ['id']]);
while ($parent = Post::fetch($parents)) {
if ($parent['gravity'] == Item::GRAVITY_PARENT) {
$profile = APContact::getByURL($parent['owner-link'], false);