mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update user_filters, use config_cache
This commit is contained in:
parent
949e99798e
commit
6ce513f8c3
4 changed files with 8 additions and 5 deletions
|
@ -157,7 +157,7 @@ class AccountController extends Controller
|
||||||
|
|
||||||
$pid = $request->user()->profile_id;
|
$pid = $request->user()->profile_id;
|
||||||
$count = UserFilterService::muteCount($pid);
|
$count = UserFilterService::muteCount($pid);
|
||||||
$maxLimit = intval(config('instance.user_filters.max_user_mutes'));
|
$maxLimit = (int) config_cache('instance.user_filters.max_user_mutes');
|
||||||
abort_if($count >= $maxLimit, 422, self::FILTER_LIMIT_MUTE_TEXT . $maxLimit . ' accounts');
|
abort_if($count >= $maxLimit, 422, self::FILTER_LIMIT_MUTE_TEXT . $maxLimit . ' accounts');
|
||||||
if($count == 0) {
|
if($count == 0) {
|
||||||
$filterCount = UserFilter::whereUserId($pid)->count();
|
$filterCount = UserFilter::whereUserId($pid)->count();
|
||||||
|
@ -260,7 +260,7 @@ class AccountController extends Controller
|
||||||
]);
|
]);
|
||||||
$pid = $request->user()->profile_id;
|
$pid = $request->user()->profile_id;
|
||||||
$count = UserFilterService::blockCount($pid);
|
$count = UserFilterService::blockCount($pid);
|
||||||
$maxLimit = intval(config('instance.user_filters.max_user_blocks'));
|
$maxLimit = (int) config_cache('instance.user_filters.max_user_blocks');
|
||||||
abort_if($count >= $maxLimit, 422, self::FILTER_LIMIT_BLOCK_TEXT . $maxLimit . ' accounts');
|
abort_if($count >= $maxLimit, 422, self::FILTER_LIMIT_BLOCK_TEXT . $maxLimit . ' accounts');
|
||||||
if($count == 0) {
|
if($count == 0) {
|
||||||
$filterCount = UserFilter::whereUserId($pid)->whereFilterType('block')->count();
|
$filterCount = UserFilter::whereUserId($pid)->whereFilterType('block')->count();
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ class ApiV1Controller extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = UserFilterService::blockCount($pid);
|
$count = UserFilterService::blockCount($pid);
|
||||||
$maxLimit = intval(config('instance.user_filters.max_user_blocks'));
|
$maxLimit = (int) config_cache('instance.user_filters.max_user_blocks');
|
||||||
if ($count == 0) {
|
if ($count == 0) {
|
||||||
$filterCount = UserFilter::whereUserId($pid)
|
$filterCount = UserFilter::whereUserId($pid)
|
||||||
->whereFilterType('block')
|
->whereFilterType('block')
|
||||||
|
@ -2145,7 +2145,7 @@ class ApiV1Controller extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = UserFilterService::muteCount($pid);
|
$count = UserFilterService::muteCount($pid);
|
||||||
$maxLimit = intval(config('instance.user_filters.max_user_mutes'));
|
$maxLimit = (int) config_cache('instance.user_filters.max_user_mutes');
|
||||||
if ($count == 0) {
|
if ($count == 0) {
|
||||||
$filterCount = UserFilter::whereUserId($pid)
|
$filterCount = UserFilter::whereUserId($pid)
|
||||||
->whereFilterType('mute')
|
->whereFilterType('mute')
|
||||||
|
|
|
@ -72,7 +72,7 @@ class DomainBlockController extends Controller
|
||||||
abort_if(config_cache('pixelfed.domain.app') == $domain, 400, 'Cannot ban your own server');
|
abort_if(config_cache('pixelfed.domain.app') == $domain, 400, 'Cannot ban your own server');
|
||||||
|
|
||||||
$existingCount = UserDomainBlock::whereProfileId($pid)->count();
|
$existingCount = UserDomainBlock::whereProfileId($pid)->count();
|
||||||
$maxLimit = config('instance.user_filters.max_domain_blocks');
|
$maxLimit = (int) config_cache('instance.user_filters.max_domain_blocks');
|
||||||
$errorMsg = __('profile.block.domain.max', ['max' => $maxLimit]);
|
$errorMsg = __('profile.block.domain.max', ['max' => $maxLimit]);
|
||||||
|
|
||||||
abort_if($existingCount >= $maxLimit, 400, $errorMsg);
|
abort_if($existingCount >= $maxLimit, 400, $errorMsg);
|
||||||
|
|
|
@ -103,6 +103,9 @@ class ConfigCacheService
|
||||||
'pixelfed.optimize_video',
|
'pixelfed.optimize_video',
|
||||||
'pixelfed.max_collection_length',
|
'pixelfed.max_collection_length',
|
||||||
'media.delete_local_after_cloud',
|
'media.delete_local_after_cloud',
|
||||||
|
'instance.user_filters.max_user_blocks',
|
||||||
|
'instance.user_filters.max_user_mutes',
|
||||||
|
'instance.user_filters.max_domain_blocks',
|
||||||
// 'system.user_mode'
|
// 'system.user_mode'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue