kopia lustrzana https://github.com/pixelfed/pixelfed
				
				
				
			Update ApiController, fix notification bug
							rodzic
							
								
									aa5b090af8
								
							
						
					
					
						commit
						f39f32c866
					
				| 
						 | 
				
			
			@ -1289,13 +1289,17 @@ class ApiV1Controller extends Controller
 | 
			
		|||
		if($max) {
 | 
			
		||||
			$res = NotificationService::getMax($pid, $max, $limit);
 | 
			
		||||
			$ids = NotificationService::getRankedMaxId($pid, $max, $limit);
 | 
			
		||||
			$maxId = max($ids);
 | 
			
		||||
			$minId = min($ids);
 | 
			
		||||
			if(!empty($ids)) {
 | 
			
		||||
				$maxId = max($ids);
 | 
			
		||||
				$minId = min($ids);
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			$res = NotificationService::getMin($pid, $min ?? $since, $limit);
 | 
			
		||||
			$ids = NotificationService::getRankedMinId($pid, $min ?? $since, $limit);
 | 
			
		||||
			$maxId = max($ids);
 | 
			
		||||
			$minId = min($ids);
 | 
			
		||||
			if(!empty($ids)) {
 | 
			
		||||
				$maxId = max($ids);
 | 
			
		||||
				$minId = min($ids);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$baseUrl = config('app.url') . '/api/v1/notifications?';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -402,8 +402,8 @@ class PublicApiController extends Controller
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        $filtered = $user ? UserFilterService::filters($user->profile_id) : [];
 | 
			
		||||
        $textOnlyPosts = Redis::zscore('pf:tl:top', $pid) !== false;
 | 
			
		||||
        $textOnlyReplies = Redis::zscore('pf:tl:replies', $pid) !== false;
 | 
			
		||||
        $textOnlyPosts = (bool) Redis::zscore('pf:tl:top', $pid);
 | 
			
		||||
        $textOnlyReplies = (bool) Redis::zscore('pf:tl:replies', $pid);
 | 
			
		||||
        $types = $textOnlyPosts ?
 | 
			
		||||
        	['text', 'photo', 'photo:album', 'video', 'video:album', 'photo:video:album'] :
 | 
			
		||||
        	['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -241,13 +241,13 @@ class SettingsController extends Controller
 | 
			
		|||
		if($top) {
 | 
			
		||||
			Redis::zadd('pf:tl:top', $pid, $pid);
 | 
			
		||||
		} else {
 | 
			
		||||
			Redis::zrem('pf:tl:top', $pid, $pid);
 | 
			
		||||
			Redis::zrem('pf:tl:top', $pid);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if($replies) {
 | 
			
		||||
			Redis::zadd('pf:tl:replies', $pid, $pid);
 | 
			
		||||
		} else {
 | 
			
		||||
			Redis::zrem('pf:tl:replies', $pid, $pid);
 | 
			
		||||
			Redis::zrem('pf:tl:replies', $pid);
 | 
			
		||||
		}
 | 
			
		||||
		return redirect(route('settings.timeline'));
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue