mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Fix default severity for domain blocks
This commit is contained in:
parent
96a226d90c
commit
626c87a420
1 changed files with 8 additions and 7 deletions
|
@ -58,14 +58,15 @@ class DomainBlocksController extends ApiController {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$domain = $request->input('domain');
|
$domain = $request->input('domain');
|
||||||
$severity = $request->input('severity');
|
$severity = $request->input('severity', 'silence');
|
||||||
$private_comment = $request->input('private_comment');
|
$private_comment = $request->input('private_comment');
|
||||||
|
|
||||||
abort_if(!strpos($domain, '.'), 400, 'Invalid domain');
|
abort_if(!strpos($domain, '.'), 400, 'Invalid domain');
|
||||||
abort_if(!filter_var($domain, FILTER_VALIDATE_DOMAIN), 400, 'Invalid domain');
|
abort_if(!filter_var($domain, FILTER_VALIDATE_DOMAIN), 400, 'Invalid domain');
|
||||||
|
|
||||||
|
// This is because Pixelfed can't currently support wildcard domain blocks
|
||||||
|
// We have to find something that could plausibly be an instance
|
||||||
$parts = explode('.', $domain);
|
$parts = explode('.', $domain);
|
||||||
|
|
||||||
if ($parts[0] == '*') {
|
if ($parts[0] == '*') {
|
||||||
// If we only have two parts, e.g., "*", "example", then we want to fail:
|
// If we only have two parts, e.g., "*", "example", then we want to fail:
|
||||||
abort_if(count($parts) <= 2, 400, 'Invalid domain: This API does not support wildcard domain blocks yet');
|
abort_if(count($parts) <= 2, 400, 'Invalid domain: This API does not support wildcard domain blocks yet');
|
||||||
|
@ -109,7 +110,7 @@ class DomainBlocksController extends ApiController {
|
||||||
'obfuscate' => 'sometimes|required|boolean'
|
'obfuscate' => 'sometimes|required|boolean'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$severity = $request->input('severity');
|
$severity = $request->input('severity', 'silence');
|
||||||
$private_comment = $request->input('private_comment');
|
$private_comment = $request->input('private_comment');
|
||||||
|
|
||||||
$domain_block = Instance::moderated()->find($id);
|
$domain_block = Instance::moderated()->find($id);
|
||||||
|
|
Loading…
Reference in a new issue