Browse Source

Update ApiV1Controller, fix notifications favourited/reblogged/bookmarked state. Fixes #5901

Daniel Supernault 3 months ago
parent
commit
8a86808a06
1 changed files with 8 additions and 0 deletions
  1. 8 0
      app/Http/Controllers/Api/ApiV1Controller.php

+ 8 - 0
app/Http/Controllers/Api/ApiV1Controller.php

@@ -2441,6 +2441,14 @@ class ApiV1Controller extends Controller
 
                 return true;
             })
+            ->map(function($n) use($pid) {
+                if(isset($n['status'])) {
+                    $n['status']['favourited'] = (bool) LikeService::liked($pid, $n['status']['id']);
+                    $n['status']['reblogged'] = (bool) ReblogService::get($pid, $n['status']['id']);
+                    $n['status']['bookmarked'] = (bool) BookmarkService::get($pid, $n['status']['id']);
+                }
+                return $n;
+            })
             ->filter(function ($n) use ($types) {
                 if (! $types) {
                     return true;