mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update PublicApiController
This commit is contained in:
parent
fe64e18712
commit
2923453e13
1 changed files with 95 additions and 101 deletions
|
@ -27,6 +27,7 @@ use App\Transformer\Api\{
|
|||
};
|
||||
use App\Services\{
|
||||
AccountService,
|
||||
FollowerService,
|
||||
LikeService,
|
||||
PublicTimelineService,
|
||||
ProfileService,
|
||||
|
@ -151,13 +152,8 @@ class PublicApiController extends Controller
|
|||
|
||||
if(Auth::check()) {
|
||||
$p = Auth::user()->profile;
|
||||
$filtered = UserFilter::whereUserId($p->id)
|
||||
->whereFilterableType('App\Profile')
|
||||
->whereIn('filter_type', ['mute', 'block'])
|
||||
->pluck('filterable_id')->toArray();
|
||||
$scope = $p->id == $status->profile_id ? ['public', 'private', 'unlisted'] : ['public','unlisted'];
|
||||
$scope = $p->id == $status->profile_id || FollowerService::follows($p->id, $profile->id) ? ['public', 'private', 'unlisted'] : ['public','unlisted'];
|
||||
} else {
|
||||
$filtered = [];
|
||||
$scope = ['public', 'unlisted'];
|
||||
}
|
||||
|
||||
|
@ -166,7 +162,6 @@ class PublicApiController extends Controller
|
|||
$replies = $status->comments()
|
||||
->whereNull('reblog_of_id')
|
||||
->whereIn('scope', $scope)
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
||||
->where('id', '>=', $request->min_id)
|
||||
->orderBy('id', 'desc')
|
||||
|
@ -176,17 +171,15 @@ class PublicApiController extends Controller
|
|||
$replies = $status->comments()
|
||||
->whereNull('reblog_of_id')
|
||||
->whereIn('scope', $scope)
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
||||
->where('id', '<=', $request->max_id)
|
||||
->orderBy('id', 'desc')
|
||||
->paginate($limit);
|
||||
}
|
||||
} else {
|
||||
$replies = $status->comments()
|
||||
$replies = Status::whereInReplyToId($status->id)
|
||||
->whereNull('reblog_of_id')
|
||||
->whereIn('scope', $scope)
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
||||
->orderBy('id', 'desc')
|
||||
->paginate($limit);
|
||||
|
@ -438,6 +431,7 @@ class PublicApiController extends Controller
|
|||
|
||||
$filtered = $user ? UserFilterService::filters($user->profile_id) : [];
|
||||
$types = ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'];
|
||||
// $types = ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album', 'text'];
|
||||
|
||||
$textOnlyReplies = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue