From 1b9c1bfa3479797f100aaf97ae2e51cebd0fcb14 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 14 Dec 2019 20:31:26 -0700 Subject: [PATCH 1/4] Update LikePipeline, fix typo --- app/Jobs/LikePipeline/LikePipeline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/LikePipeline/LikePipeline.php b/app/Jobs/LikePipeline/LikePipeline.php index 593b4c4bc..a7dddc107 100644 --- a/app/Jobs/LikePipeline/LikePipeline.php +++ b/app/Jobs/LikePipeline/LikePipeline.php @@ -55,7 +55,7 @@ class LikePipeline implements ShouldQueue return; } - if($status->url && $actor->domain == null) { + if($status->url && $actor->domain !== null) { return $this->remoteLikeDeliver(); } From 813ef123294a3d2d88d5afb6343faab5f9dbbd27 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 14 Dec 2019 20:34:56 -0700 Subject: [PATCH 2/4] Update LikePipeline, fix typo --- app/Jobs/LikePipeline/LikePipeline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/LikePipeline/LikePipeline.php b/app/Jobs/LikePipeline/LikePipeline.php index a7dddc107..593b4c4bc 100644 --- a/app/Jobs/LikePipeline/LikePipeline.php +++ b/app/Jobs/LikePipeline/LikePipeline.php @@ -55,7 +55,7 @@ class LikePipeline implements ShouldQueue return; } - if($status->url && $actor->domain !== null) { + if($status->url && $actor->domain == null) { return $this->remoteLikeDeliver(); } From aa1f74efbc28bb62907cdec3a6a84b1c231947bf Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 14 Dec 2019 21:27:42 -0700 Subject: [PATCH 3/4] Add exception lang file --- resources/lang/en/exception.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 resources/lang/en/exception.php diff --git a/resources/lang/en/exception.php b/resources/lang/en/exception.php new file mode 100644 index 000000000..c4eb63a10 --- /dev/null +++ b/resources/lang/en/exception.php @@ -0,0 +1,11 @@ + [ + 'invalid' => [ + 'album' => 'Must contain a single photo or video or multiple photos.', + ], + ], + +]; \ No newline at end of file From 1b20ebd46d83a0ffd5db74801b8eccf9778492ec Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 14 Dec 2019 21:29:00 -0700 Subject: [PATCH 4/4] Deprecate mixed media albums --- app/Http/Controllers/InternalApiController.php | 8 +++++++- resources/assets/js/components/ComposeClassic.vue | 8 ++------ resources/assets/js/components/ComposeModal.vue | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/InternalApiController.php b/app/Http/Controllers/InternalApiController.php index 25a90d8fb..9cfff70ce 100644 --- a/app/Http/Controllers/InternalApiController.php +++ b/app/Http/Controllers/InternalApiController.php @@ -290,6 +290,12 @@ class InternalApiController extends Controller array_push($mimes, $m->mime); } + $mediaType = StatusController::mimeTypeCheck($mimes); + + if(in_array($mediaType, ['photo', 'video', 'photo:album']) == false) { + abort(400, __('exception.compose.invalid.album')); + } + if($place && is_array($place)) { $status->place_id = $place['id']; } @@ -317,7 +323,7 @@ class InternalApiController extends Controller $status->is_nsfw = $cw; $status->visibility = $visibility; $status->scope = $visibility; - $status->type = StatusController::mimeTypeCheck($mimes); + $status->type = $mediaType; $status->save(); NewStatusPipeline::dispatch($status); diff --git a/resources/assets/js/components/ComposeClassic.vue b/resources/assets/js/components/ComposeClassic.vue index 24f49ea8c..f86363824 100644 --- a/resources/assets/js/components/ComposeClassic.vue +++ b/resources/assets/js/components/ComposeClassic.vue @@ -453,12 +453,8 @@ export default { let data = res.data; window.location.href = data; }).catch(err => { - let res = err.response.data; - if(res.message == 'Too Many Attempts.') { - swal('You\'re posting too much!', 'We only allow 50 posts per hour or 100 per day. If you\'ve reached that limit, please try again later. If you think this is an error, please contact an administrator.', 'error'); - return; - } - swal('Oops, something went wrong!', 'An unexpected error occurred.', 'error'); + let msg = err.response.data.message ? err.response.data.message : 'An unexpected error occured.' + swal('Oops, something went wrong!', msg, 'error'); }); return; break; diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index d021be280..daced1ef2 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -744,7 +744,8 @@ export default { let data = res.data; window.location.href = data; }).catch(err => { - swal('Oops, something went wrong!', 'An unexpected error occurred.', 'error'); + let msg = err.response.data.message ? err.response.data.message : 'An unexpected error occured.' + swal('Oops, something went wrong!', msg, 'error'); }); return; break;