Merge pull request #3210 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-02-05 19:09:21 -07:00 committed by GitHub
commit 19e0a9085b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 6 deletions

View file

@ -10,6 +10,8 @@
- Fix word-break on statuses ([16ced7b4](https://github.com/pixelfed/pixelfed/commit/16ced7b4))
- Add pronouns to hovercards ([33f863e8](https://github.com/pixelfed/pixelfed/commit/33f863e8))
- Improved onboarding ([042c5b6c](https://github.com/pixelfed/pixelfed/commit/042c5b6c))
- Add Hide Counts & Stats setting ([01af7d80](https://github.com/pixelfed/pixelfed/commit/01af7d80))
- Fix nsfw videos not displaying sensitive warning ([01af7d80](https://github.com/pixelfed/pixelfed/commit/01af7d80))
### Updated
- Updated MediaStorageService, fix remote avatar bug. ([1c20d696](https://github.com/pixelfed/pixelfed/commit/1c20d696))
@ -28,6 +30,8 @@
- Updated StatusService, use BookmarkService for bookmarked state. ([a7d71551](https://github.com/pixelfed/pixelfed/commit/a7d71551))
- Updated Apis, added ReblogService to improve reblogged state for api entities ([6cfd6be5](https://github.com/pixelfed/pixelfed/commit/6cfd6be5))
- Updated InstanceActorController, fix content-type header. ([21792246](https://github.com/pixelfed/pixelfed/commit/21792246))
- Updated Exception handler to report validation message bag errors. ([74905ba1](https://github.com/pixelfed/pixelfed/commit/74905ba1))
- Updated ApiV1Controller, add validation messages to update_credentials endpoint. ([cd785601](https://github.com/pixelfed/pixelfed/commit/cd785601))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)

View file

@ -68,11 +68,20 @@ class Handler extends ExceptionHandler
*/
public function render($request, Throwable $exception)
{
if ($request->wantsJson())
if ($exception instanceof \Illuminate\Validation\ValidationException && $request->wantsJson()) {
return response()->json(
[
'message' => $exception->getMessage(),
'errors' => $exception->validator->getMessageBag()
],
method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : 500
);
} else if ($request->wantsJson()) {
return response()->json(
['error' => $exception->getMessage()],
method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : 500
);
}
return parent::render($request, $exception);
}
}

View file

@ -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) {

View file

@ -24,14 +24,13 @@ class PrettyNumber
return $number;
}
public static function size($expression, $kb = false)
public static function size($expression, $kb = false, $short = true)
{
if ($kb) {
$expression = $expression * 1024;
}
$size = intval($expression);
$precision = 0;
$short = true;
$units = $short ?
['B', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] :
['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

BIN
public/js/spa.js vendored

Binary file not shown.

Binary file not shown.