mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02: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\{
|
use App\Services\{
|
||||||
AccountService,
|
AccountService,
|
||||||
|
FollowerService,
|
||||||
LikeService,
|
LikeService,
|
||||||
PublicTimelineService,
|
PublicTimelineService,
|
||||||
ProfileService,
|
ProfileService,
|
||||||
|
@ -151,13 +152,8 @@ class PublicApiController extends Controller
|
||||||
|
|
||||||
if(Auth::check()) {
|
if(Auth::check()) {
|
||||||
$p = Auth::user()->profile;
|
$p = Auth::user()->profile;
|
||||||
$filtered = UserFilter::whereUserId($p->id)
|
$scope = $p->id == $status->profile_id || FollowerService::follows($p->id, $profile->id) ? ['public', 'private', 'unlisted'] : ['public','unlisted'];
|
||||||
->whereFilterableType('App\Profile')
|
|
||||||
->whereIn('filter_type', ['mute', 'block'])
|
|
||||||
->pluck('filterable_id')->toArray();
|
|
||||||
$scope = $p->id == $status->profile_id ? ['public', 'private', 'unlisted'] : ['public','unlisted'];
|
|
||||||
} else {
|
} else {
|
||||||
$filtered = [];
|
|
||||||
$scope = ['public', 'unlisted'];
|
$scope = ['public', 'unlisted'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +162,6 @@ class PublicApiController extends Controller
|
||||||
$replies = $status->comments()
|
$replies = $status->comments()
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereIn('scope', $scope)
|
->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')
|
->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)
|
->where('id', '>=', $request->min_id)
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
|
@ -176,17 +171,15 @@ class PublicApiController extends Controller
|
||||||
$replies = $status->comments()
|
$replies = $status->comments()
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereIn('scope', $scope)
|
->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')
|
->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)
|
->where('id', '<=', $request->max_id)
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$replies = $status->comments()
|
$replies = Status::whereInReplyToId($status->id)
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereIn('scope', $scope)
|
->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')
|
->select('id', 'caption', 'local', 'visibility', 'scope', 'is_nsfw', 'rendered', 'profile_id', 'in_reply_to_id', 'type', 'reply_count', 'created_at')
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
|
@ -438,6 +431,7 @@ class PublicApiController extends Controller
|
||||||
|
|
||||||
$filtered = $user ? UserFilterService::filters($user->profile_id) : [];
|
$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'];
|
||||||
|
// $types = ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album', 'text'];
|
||||||
|
|
||||||
$textOnlyReplies = false;
|
$textOnlyReplies = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue