mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Update ApiV1Controller, use admin filter service
This commit is contained in:
parent
18382e8a1f
commit
94503a1cf9
1 changed files with 17 additions and 1 deletions
|
@ -37,6 +37,7 @@ use App\Models\Conversation;
|
||||||
use App\Notification;
|
use App\Notification;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
use App\Services\AccountService;
|
use App\Services\AccountService;
|
||||||
|
use App\Services\AdminShadowFilterService;
|
||||||
use App\Services\BookmarkService;
|
use App\Services\BookmarkService;
|
||||||
use App\Services\BouncerService;
|
use App\Services\BouncerService;
|
||||||
use App\Services\CollectionService;
|
use App\Services\CollectionService;
|
||||||
|
@ -2648,7 +2649,7 @@ class ApiV1Controller extends Controller
|
||||||
$domainBlocks = UserFilterService::domainBlocks($user->profile_id);
|
$domainBlocks = UserFilterService::domainBlocks($user->profile_id);
|
||||||
$hideNsfw = config('instance.hide_nsfw_on_public_feeds');
|
$hideNsfw = config('instance.hide_nsfw_on_public_feeds');
|
||||||
$amin = SnowflakeService::byDate(now()->subDays(config('federation.network_timeline_days_falloff')));
|
$amin = SnowflakeService::byDate(now()->subDays(config('federation.network_timeline_days_falloff')));
|
||||||
|
$asf = AdminShadowFilterService::getHideFromPublicFeedsList();
|
||||||
if ($local && $remote) {
|
if ($local && $remote) {
|
||||||
$feed = Status::select(
|
$feed = Status::select(
|
||||||
'id',
|
'id',
|
||||||
|
@ -2824,6 +2825,21 @@ class ApiV1Controller extends Controller
|
||||||
|
|
||||||
return ! in_array($domain, $domainBlocks);
|
return ! in_array($domain, $domainBlocks);
|
||||||
})
|
})
|
||||||
|
->filter(function ($s) use ($asf, $user) {
|
||||||
|
if (! $asf || count($asf) === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($s['account']['id'], $asf)) {
|
||||||
|
if ($user->profile_id == $s['account']['id']) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
->take($limit)
|
->take($limit)
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue