From 08ba9e4183718df1941889a572c8bc9ddd190232 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 21 Feb 2023 21:07:41 +0000 Subject: [PATCH] Fix emoji activities --- src/Content/Conversation.php | 4 ++-- src/Model/Item.php | 2 +- src/Protocol/OStatus.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 8107759534..249190b1ad 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -1146,8 +1146,8 @@ class Conversation $emojis[$row['thr-parent-id']][$index]['emoji'] = $emoji; $emojis[$row['thr-parent-id']][$index]['verb'] = $row['verb']; - $emojis[$row['thr-parent-id']][$index]['total'] = $emojis[$row['thr-parent-id']][$emoji]['total'] ?? 0 + $row['total']; - $emojis[$row['thr-parent-id']][$index]['title'] = array_unique(array_merge($emojis[$row['thr-parent-id']][$emoji]['title'] ?? [], explode($separator, $row['title']))); + $emojis[$row['thr-parent-id']][$index]['total'] = ($emojis[$row['thr-parent-id']][$index]['total'] ?? 0) + $row['total']; + $emojis[$row['thr-parent-id']][$index]['title'] = array_unique(array_merge($emojis[$row['thr-parent-id']][$index]['title'] ?? [], explode($separator, $row['title']))); } DBA::close($rows); diff --git a/src/Model/Item.php b/src/Model/Item.php index feb7ae6be6..a62d3c2e6e 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1212,7 +1212,7 @@ class Item } // The content of activities normally doesn't matter - except for likes from Misskey - if (!in_array($item['verb'], self::ACTIVITIES) || in_array($item['verb'], [Activity::LIKE, Activity::DISLIKE]) && !empty($item['body']) && ($item['body'] != $item['verb'])) { + if (!in_array($item['verb'], self::ACTIVITIES) || in_array($item['verb'], [Activity::LIKE, Activity::DISLIKE]) && !empty($item['body']) && (mb_strlen($item['body']) == 1)) { Post\Content::insert($item['uri-id'], $item); } diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 80644329ff..a93a0584dd 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -496,7 +496,7 @@ class OStatus $orig_uri = $xpath->query('activity:object/atom:id', $entry)->item(0)->nodeValue; Logger::notice('Favorite', ['uri' => $orig_uri, 'item' => $item]); - $item['verb'] = Activity::LIKE; + $item['body'] = $item['verb'] = Activity::LIKE; $item['thr-parent'] = $orig_uri; $item['gravity'] = Item::GRAVITY_ACTIVITY; $item['object-type'] = Activity\ObjectType::NOTE; -- 2.39.5