1
0
Эх сурвалжийг харах

Update ApiV1Controller, fix max_id pagination on home and public timeline feeds

Daniel Supernault 3 сар өмнө
parent
commit
38e17a06e0

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

@@ -2554,7 +2554,7 @@ class ApiV1Controller extends Controller
                 $minId = null;
                 $minId = null;
             }
             }
 
 
-            if ($maxId) {
+            if ($maxId && $res->count() >= $limit) {
                 $link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next"';
                 $link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next"';
             }
             }
 
 
@@ -2977,7 +2977,7 @@ class ApiV1Controller extends Controller
             $minId = null;
             $minId = null;
         }
         }
 
 
-        if ($maxId) {
+        if ($maxId && $res->count() >= $limit) {
             $link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next"';
             $link = '<'.$baseUrl.'max_id='.$minId.'>; rel="next"';
         }
         }
 
 

+ 3 - 3
app/Services/LikeService.php

@@ -79,13 +79,13 @@ class LikeService {
 
 
 		$res = Cache::remember('pf:services:likes:liked_by:' . $status->id, 86400, function() use($status, $empty) {
 		$res = Cache::remember('pf:services:likes:liked_by:' . $status->id, 86400, function() use($status, $empty) {
 			$like = Like::whereStatusId($status->id)->first();
 			$like = Like::whereStatusId($status->id)->first();
-			if(!$like) {
+			if(!$like || !$like->profile_id) {
 				return $empty;
 				return $empty;
 			}
 			}
 			$id = $like->profile_id;
 			$id = $like->profile_id;
-			$profile = ProfileService::get($id, true);
+			$profile = AccountService::get($id, true);
 			if(!$profile) {
 			if(!$profile) {
-				return [];
+				return $empty;
 			}
 			}
 			$profileUrl = "/i/web/profile/{$profile['id']}";
 			$profileUrl = "/i/web/profile/{$profile['id']}";
 			$res = [
 			$res = [