mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-23 15:29:50 +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',
|
'account',
|
||||||
'status',
|
'status',
|
||||||
'relationship',
|
'relationship',
|
||||||
'modlog'
|
'modlog',
|
||||||
|
'tagged'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function transform(Notification $notification)
|
public function transform(Notification $notification)
|
||||||
|
@ -55,7 +56,8 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
||||||
'share' => 'share',
|
'share' => 'share',
|
||||||
'like' => 'favourite',
|
'like' => 'favourite',
|
||||||
'comment' => 'comment',
|
'comment' => 'comment',
|
||||||
'admin.user.modlog.comment' => 'modlog'
|
'admin.user.modlog.comment' => 'modlog',
|
||||||
|
'tagged' => 'tagged'
|
||||||
];
|
];
|
||||||
return $verbs[$verb];
|
return $verbs[$verb];
|
||||||
}
|
}
|
||||||
|
@ -85,4 +87,22 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
||||||
return null;
|
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