mirror of https://github.com/pixelfed/pixelfed.git
Fix mastoapi notification type casting to include comment and share (mention and reblog) notifications
This commit is contained in:
parent
10eaffb074
commit
eba84530aa
|
@ -105,7 +105,7 @@ class NotificationService {
|
||||||
|
|
||||||
$res = collect([]);
|
$res = collect([]);
|
||||||
foreach($ids as $id) {
|
foreach($ids as $id) {
|
||||||
$n = self::getNotification($id);
|
$n = self::rewriteMastodonTypes(self::getNotification($id));
|
||||||
if($n != null && in_array($n['type'], self::MASTODON_TYPES)) {
|
if($n != null && in_array($n['type'], self::MASTODON_TYPES)) {
|
||||||
$n['account'] = AccountService::getMastodon($n['account']['id']);
|
$n['account'] = AccountService::getMastodon($n['account']['id']);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class NotificationService {
|
||||||
|
|
||||||
$res = collect([]);
|
$res = collect([]);
|
||||||
foreach($ids as $id) {
|
foreach($ids as $id) {
|
||||||
$n = self::getNotification($id);
|
$n = self::rewriteMastodonTypes(self::getNotification($id));
|
||||||
if($n != null && in_array($n['type'], self::MASTODON_TYPES)) {
|
if($n != null && in_array($n['type'], self::MASTODON_TYPES)) {
|
||||||
$n['account'] = AccountService::getMastodon($n['account']['id']);
|
$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)
|
public static function set($id, $val)
|
||||||
{
|
{
|
||||||
return Redis::zadd(self::CACHE_KEY . $id, $val, $val);
|
return Redis::zadd(self::CACHE_KEY . $id, $val, $val);
|
||||||
|
|
Loading…
Reference in New Issue