From e8b8397f3e29f610ffa2ad8fa4d67829d9e5e1ae Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 25 Mar 2019 20:49:27 -0600 Subject: [PATCH] =?UTF-8?q?Retire=20experimental=20Compose=20UI=20?= =?UTF-8?q?=F0=9F=98=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/InternalApiController.php | 61 +- app/Http/Controllers/StatusController.php | 2 +- resources/views/status/compose.blade.php | 529 ------------------ .../views/timeline/partial/new-form.blade.php | 4 - 4 files changed, 2 insertions(+), 594 deletions(-) delete mode 100644 resources/views/status/compose.blade.php diff --git a/app/Http/Controllers/InternalApiController.php b/app/Http/Controllers/InternalApiController.php index 4502fefe4..dd7533059 100644 --- a/app/Http/Controllers/InternalApiController.php +++ b/app/Http/Controllers/InternalApiController.php @@ -43,66 +43,7 @@ class InternalApiController extends Controller // deprecated v2 compose api public function compose(Request $request) { - $this->validate($request, [ - 'caption' => 'nullable|string', - 'media.*' => 'required', - 'media.*.id' => 'required|integer|min:1', - 'media.*.filter' => 'nullable|alpha_dash|max:30', - 'media.*.license' => 'nullable|string|max:80', - 'visibility' => 'required|string|in:public,private|min:2|max:10' - ]); - - $profile = Auth::user()->profile; - $visibility = $request->input('visibility'); - $medias = $request->input('media'); - $attachments = []; - $status = new Status; - $mimes = []; - $cw = false; - - foreach($medias as $k => $media) { - if($k + 1 > config('pixelfed.max_album_length')) { - continue; - } - $m = Media::findOrFail($media['id']); - if($m->profile_id !== $profile->id || $m->status_id) { - abort(403, 'Invalid media id'); - } - $m->filter_class = in_array($media['filter'], Filter::classes()) ? $media['filter'] : null; - $m->license = $media['license']; - $m->caption = strip_tags($media['alt']); - $m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k; - if($media['cw'] == true || $profile->cw == true) { - $cw = true; - $m->is_nsfw = true; - $status->is_nsfw = true; - } - $m->save(); - $attachments[] = $m; - array_push($mimes, $m->mime); - } - - $status->caption = strip_tags($request->caption); - $status->scope = 'draft'; - $status->profile_id = $profile->id; - $status->save(); - - foreach($attachments as $media) { - $media->status_id = $status->id; - $media->save(); - } - - $visibility = $profile->unlisted == true && $visibility == 'public' ? 'unlisted' : $visibility; - $cw = $profile->cw == true ? true : $cw; - $status->is_nsfw = $cw; - $status->visibility = $visibility; - $status->scope = $visibility; - $status->type = StatusController::mimeTypeCheck($mimes); - $status->save(); - - NewStatusPipeline::dispatch($status); - - return $status->url(); + return redirect('/'); } // deprecated diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index a77d6affc..e07431081 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -95,7 +95,7 @@ class StatusController extends Controller { $this->authCheck(); - return view('status.compose'); + return redirect('/'); } public function store(Request $request) diff --git a/resources/views/status/compose.blade.php b/resources/views/status/compose.blade.php deleted file mode 100644 index 156563ffb..000000000 --- a/resources/views/status/compose.blade.php +++ /dev/null @@ -1,529 +0,0 @@ -@extends('layouts.app') - -@section('content') -
-
-
-
- - -
-
-

- Compose -

-
-
-
-
- -
-
-
-
-
-
-
-
-

-

- 1 - of - 2 -

-

-
-
-
- -
-
-
-
-
-
- -
- - - - {{-- - --}} -
-
-
- - -
-
- -
-
- -
-
-
-
-

Select a photo or video.

-
-
- -
-
-
- -@endsection - -@push('scripts') - -@endpush diff --git a/resources/views/timeline/partial/new-form.blade.php b/resources/views/timeline/partial/new-form.blade.php index 0a204be74..201b66c03 100644 --- a/resources/views/timeline/partial/new-form.blade.php +++ b/resources/views/timeline/partial/new-form.blade.php @@ -1,10 +1,6 @@
{{__('Create New Post')}}
-
- NEW - Experimental UI -