Просмотр исходного кода

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

Daniel Supernault 3 месяцев назад
Родитель
Сommit
8a86808a06
1 измененных файлов с 8 добавлено и 0 удалено
  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;
                 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) {
             ->filter(function ($n) use ($types) {
                 if (! $types) {
                 if (! $types) {
                     return true;
                     return true;