Explorar o código

Update ApiV1Controller, fix tag timeline limits and remove has(media) constraint

Daniel Supernault %!s(int64=3) %!d(string=hai) anos
pai
achega
8c65d60b77
Modificáronse 1 ficheiros con 7 adicións e 7 borrados
  1. 7 7
      app/Http/Controllers/Api/ApiV1Controller.php

+ 7 - 7
app/Http/Controllers/Api/ApiV1Controller.php

@@ -2365,7 +2365,7 @@ class ApiV1Controller extends Controller
 		  'page'        => 'nullable|integer|max:40',
 		  'min_id'      => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
 		  'max_id'      => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
-		  'limit'       => 'nullable|integer|max:40'
+		  'limit'       => 'nullable|integer|max:100'
 		]);
 
 		$tag = Hashtag::whereName($hashtag)
@@ -2390,18 +2390,18 @@ class ApiV1Controller extends Controller
 
 		$res = StatusHashtag::whereHashtagId($tag->id)
 			->whereStatusVisibility('public')
-			->whereHas('media')
 			->where('status_id', $dir, $id)
 			->latest()
 			->limit($limit)
 			->pluck('status_id')
-			->filter(function($i) {
-				return StatusService::getMastodon($i);
-			})
 			->map(function ($i) {
-				return StatusService::getMastodon($i);
+				if($i) {
+					return StatusService::getMastodon($i);
+				}
+			})
+			->filter(function($i) {
+				return $i && isset($i['account']);
 			})
-			->filter()
 			->values()
 			->toArray();