From eba84530aac2acf9de2f6f744f7d1bad663fe63f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 4 Aug 2022 02:13:33 -0600 Subject: [PATCH 1/2] Fix mastoapi notification type casting to include comment and share (mention and reblog) notifications --- app/Services/NotificationService.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Services/NotificationService.php b/app/Services/NotificationService.php index 51ff829c..cd0044bb 100644 --- a/app/Services/NotificationService.php +++ b/app/Services/NotificationService.php @@ -105,7 +105,7 @@ class NotificationService { $res = collect([]); foreach($ids as $id) { - $n = self::getNotification($id); + $n = self::rewriteMastodonTypes(self::getNotification($id)); if($n != null && in_array($n['type'], self::MASTODON_TYPES)) { $n['account'] = AccountService::getMastodon($n['account']['id']); @@ -133,7 +133,7 @@ class NotificationService { $res = collect([]); foreach($ids as $id) { - $n = self::getNotification($id); + $n = self::rewriteMastodonTypes(self::getNotification($id)); if($n != null && in_array($n['type'], self::MASTODON_TYPES)) { $n['account'] = AccountService::getMastodon($n['account']['id']); @@ -175,6 +175,23 @@ class NotificationService { ])); } + public static function rewriteMastodonTypes($notification) + { + if(!$notification || !isset($notification['type'])) { + return $notification; + } + + if($notification['type'] === 'comment') { + $notification['type'] = 'mention'; + } + + if($notification['type'] === 'share') { + $notification['type'] = 'reblog'; + } + + return $notification; + } + public static function set($id, $val) { return Redis::zadd(self::CACHE_KEY . $id, $val, $val); From 872f5f879b9fad2d2127fab7edd5da5f5e4244f8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 4 Aug 2022 02:14:14 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5abf9b8..c597837d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - Update unfollow api endpoint to only decrement when appropriate, fixes #3539 ([44de1ad7](https://github.com/pixelfed/pixelfed/commit/44de1ad7)) - Improve cache invalidation after processing VideoThumbnail to eliminate "No Preview Available" on grid feeds ([47571887](https://github.com/pixelfed/pixelfed/commit/47571887)) - Use poster in VideoPresenter component ([a3cc90b0](https://github.com/pixelfed/pixelfed/commit/a3cc90b0)) +- Fix mastoapi notification type casting to include comment and share (mention and reblog) notifications ([eba84530](https://github.com/pixelfed/pixelfed/commit/eba84530)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)