Merge pull request #10695 from annando/commenting

Fix commenting on public posts
This commit is contained in:
Hypolite Petovan 2021-09-12 00:19:10 -04:00 committed by GitHub
commit 9ab217c6e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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' => []];
}