mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update NotificationTransformer, add modlog and tagged types
This commit is contained in:
parent
9db71f8b77
commit
49dab6fb5a
1 changed files with 22 additions and 2 deletions
|
@ -14,7 +14,8 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
|||
'account',
|
||||
'status',
|
||||
'relationship',
|
||||
'modlog'
|
||||
'modlog',
|
||||
'tagged'
|
||||
];
|
||||
|
||||
public function transform(Notification $notification)
|
||||
|
@ -55,7 +56,8 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
|||
'share' => 'share',
|
||||
'like' => 'favourite',
|
||||
'comment' => 'comment',
|
||||
'admin.user.modlog.comment' => 'modlog'
|
||||
'admin.user.modlog.comment' => 'modlog',
|
||||
'tagged' => 'tagged'
|
||||
];
|
||||
return $verbs[$verb];
|
||||
}
|
||||
|
@ -85,4 +87,22 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function includeTagged(Notification $notification)
|
||||
{
|
||||
$n = $notification;
|
||||
if($n->item_id && $n->item_type == 'App\MediaTag') {
|
||||
$ml = $n->item;
|
||||
$res = $this->item($ml, function($ml) {
|
||||
return [
|
||||
'username' => $ml->status->profile->username,
|
||||
'post_url' => $ml->status->url()
|
||||
];
|
||||
});
|
||||
return $res;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue