]> git.mxchange.org Git - friendica.git/commitdiff
Fix emoji activities
authorMichael <heluecht@pirati.ca>
Tue, 21 Feb 2023 21:07:41 +0000 (21:07 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 21 Feb 2023 21:07:41 +0000 (21:07 +0000)
src/Content/Conversation.php
src/Model/Item.php
src/Protocol/OStatus.php

index 8107759534c37250cf793995aeddb8930c5f25e1..249190b1add67c4630aebf2aad6551cd2b5218ff 100644 (file)
@@ -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);
 
index feb7ae6be60c3d990254abc1bf3a961df0f32e95..a62d3c2e6efbb5d7b9d99371431cfb07a379e51d 100644 (file)
@@ -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);
                }
 
index 80644329ff4d857fc05269ce23e10be935214316..a93a0584dd234b05fb29f8ce2cc82ca3f683e481 100644 (file)
@@ -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;