Fix mastoapi notification type casting to include comment and share (mention and reblog) notifications

pull/3604/head
Daniel Supernault 2022-08-04 02:13:33 -06:00
rodzic 10eaffb074
commit eba84530aa
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 19 dodań i 2 usunięć

Wyświetl plik

@ -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);