mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 08:14:10 +00:00
Update ApiV1Controller, add validation messages to update_credentials endpoint
This commit is contained in:
parent
74905ba1d0
commit
cd78560184
1 changed files with 6 additions and 3 deletions
|
@ -74,6 +74,7 @@ use App\Services\{
|
|||
UserFilterService
|
||||
};
|
||||
use App\Util\Lexer\Autolink;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use App\Util\Localization\Localization;
|
||||
use App\Util\Media\License;
|
||||
use App\Jobs\MediaPipeline\MediaSyncLicensePipeline;
|
||||
|
@ -182,13 +183,17 @@ class ApiV1Controller extends Controller
|
|||
abort_if(!$request->user(), 403);
|
||||
|
||||
$this->validate($request, [
|
||||
'avatar' => 'sometimes|mimetypes:image/jpeg,image/png',
|
||||
'avatar' => 'sometimes|mimetypes:image/jpeg,image/png|min:10|max:' . config('pixelfed.max_avatar_size'),
|
||||
'display_name' => 'nullable|string',
|
||||
'note' => 'nullable|string',
|
||||
'locked' => 'nullable',
|
||||
'website' => 'nullable',
|
||||
// 'source.privacy' => 'nullable|in:unlisted,public,private',
|
||||
// 'source.sensitive' => 'nullable|boolean'
|
||||
], [
|
||||
'required' => 'The :attribute field is required.',
|
||||
'avatar.mimetypes' => 'The file must be in jpeg or png format',
|
||||
'avatar.max' => 'The :attribute exceeds the file size limit of ' . PrettyNumber::size(config('pixelfed.max_avatar_size'), true, false),
|
||||
]);
|
||||
|
||||
$user = $request->user();
|
||||
|
@ -201,8 +206,6 @@ class ApiV1Controller extends Controller
|
|||
$licenseChanged = false;
|
||||
$composeSettings = array_merge(AccountService::defaultSettings()['compose_settings'], $settings->compose_settings ?? []);
|
||||
|
||||
// return $request->input('locked');
|
||||
|
||||
if($request->has('avatar')) {
|
||||
$av = Avatar::whereProfileId($profile->id)->first();
|
||||
if($av) {
|
||||
|
|
Loading…
Reference in a new issue