Skip to content

Commit

Permalink
Update NotificationTransformer, fix mediaTag and modLog types
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Nov 18, 2022
1 parent 8665eab commit b6c06c4
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app/Transformer/Api/NotificationTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,22 @@ public function transform(Notification $notification)

if($n->item_id && $n->item_type == 'App\ModLog') {
$ml = $n->item;
$res['modlog'] = [
'id' => $ml->object_uid,
'url' => url('/i/admin/users/modlogs/' . $ml->object_uid)
];
if($ml && $ml->object_uid) {
$res['modlog'] = [
'id' => $ml->object_uid,
'url' => url('/i/admin/users/modlogs/' . $ml->object_uid)
];
}
}

if($n->item_id && $n->item_type == 'App\MediaTag') {
$ml = $n->item;
$res['tagged'] = [
'username' => $ml->tagged_username,
'post_url' => '/p/'.HashidService::encode($ml->status_id)
];
if($ml && $ml->tagged_username) {
$res['tagged'] = [
'username' => $ml->tagged_username,
'post_url' => '/p/'.HashidService::encode($ml->status_id)
];
}
}

return $res;
Expand Down

0 comments on commit b6c06c4

Please sign in to comment.