Fix commenting on public posts

This commit is contained in:
Michael 2021-09-12 01:52:10 +00:00
parent 8628bd5228
commit 9191daf12f
2 changed files with 14 additions and 1 deletions

View File

@ -659,6 +659,12 @@ class Item
$params = ['order' => ['id' => false]];
$parent = Post::selectFirst($fields, $condition, $params);
if (!DBA::isResult($parent) && $item['origin']) {
$stored = Item::storeForUserByUriId($item['thr-parent-id'], $item['uid']);
Logger::info('Stored thread parent item for user', ['uri-id' => $item['thr-parent-id'], 'uid' => $item['uid'], 'stored' => $stored]);
$parent = Post::selectFirst($fields, $condition, $params);
}
if (!DBA::isResult($parent)) {
Logger::notice('item parent was not found - ignoring item', ['thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
return [];
@ -673,6 +679,13 @@ class Item
'uid' => $parent['uid']];
$params = ['order' => ['id' => false]];
$toplevel_parent = Post::selectFirst($fields, $condition, $params);
if (!DBA::isResult($toplevel_parent) && $item['origin']) {
$stored = Item::storeForUserByUriId($item['parent-uri-id'], $item['uid']);
Logger::info('Stored parent item for user', ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid'], 'stored' => $stored]);
$toplevel_parent = Post::selectFirst($fields, $condition, $params);
}
if (!DBA::isResult($toplevel_parent)) {
Logger::notice('item top level parent was not found - ignoring item', ['parent-uri-id' => $parent['parent-uri-id'], 'uid' => $parent['uid']]);
return [];

View File

@ -744,7 +744,7 @@ class Notifier
// Also don't deliver when the direct thread parent was delivered via Diaspora
if ($thr_parent['network'] == Protocol::DIASPORA) {
Logger::info('Threat parent network is Diaspora, so no AP delivery');
Logger::info('Thread parent network is Diaspora, so no AP delivery');
return ['count' => 0, 'contacts' => []];
}