Only search for empty quoted reshares (Diaspora type)

This commit is contained in:
Michael 2022-12-13 23:26:58 +00:00
parent ca8a89ed1c
commit f013c92487
4 changed files with 6 additions and 4 deletions

View File

@ -1020,7 +1020,7 @@ class Conversation
DBA::close($thread_items);
$quotes = Post::select(array_merge(ItemModel::DISPLAY_FIELDLIST, ['featured', 'contact-uid', 'gravity', 'post-type', 'post-reason']), ['quote-uri-id' => array_column($quoteuriids, 'uri-id'), 'uid' => 0]);
$quotes = Post::select(array_merge(ItemModel::DISPLAY_FIELDLIST, ['featured', 'contact-uid', 'gravity', 'post-type', 'post-reason']), ['quote-uri-id' => array_column($quoteuriids, 'uri-id'), 'body' => '', 'uid' => 0]);
while ($quote = Post::fetch($quotes)) {
$row = $quote;

View File

@ -117,7 +117,8 @@ class Status extends BaseFactory
'deleted' => false
]) + Post::countPosts([
'quote-uri-id' => $uriId,
'deleted' => false
'body' => '',
'deleted' => false
]);
$count_like = Post::countPosts([
@ -152,6 +153,7 @@ class Status extends BaseFactory
'quote-uri-id' => $uriId,
'uid' => $uid,
'origin' => true,
'body' => '',
'deleted' => false
]);
$userAttributes = new \Friendica\Object\Api\Mastodon\Status\UserAttributes(

View File

@ -50,7 +50,7 @@ class Unreblog extends BaseApi
}
if ($item['network'] == Protocol::DIASPORA) {
$item = Post::selectFirstForUser($uid, ['id'], ['quote-uri-id' => $this->parameters['id'], 'origin' => true, 'uid' => $uid]);
$item = Post::selectFirstForUser($uid, ['id'], ['quote-uri-id' => $this->parameters['id'], 'body' => '', 'origin' => true, 'uid' => $uid]);
if (empty($item['id'])) {
DI::mstdnError()->RecordNotFound();
}

View File

@ -53,7 +53,7 @@ class Activity extends BaseModule
if (in_array($verb, ['announce', 'unannounce'])) {
$item = Post::selectFirst(['network', 'uri-id'], ['id' => $itemId, 'uid' => [DI::userSession()->getLocalUserId(), 0]]);
if ($item['network'] == Protocol::DIASPORA) {
$quote = Post::selectFirst(['id'], ['quote-uri-id' => $item['uri-id'], 'origin' => true, 'uid' => DI::userSession()->getLocalUserId()]);
$quote = Post::selectFirst(['id'], ['quote-uri-id' => $item['uri-id'], 'body' => '', 'origin' => true, 'uid' => DI::userSession()->getLocalUserId()]);
if (!empty($quote['id'])) {
if (!Item::markForDeletionById($quote['id'])) {
throw new HTTPException\BadRequestException();