From 63343ae5033035d44b25ed4448cd498f8e762fbb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 9 Jun 2018 16:29:36 -0600 Subject: [PATCH] Add basic CW/NSFW support --- app/Http/Controllers/StatusController.php | 6 +- public/css/app.css | Bin 200971 -> 202777 bytes public/mix-manifest.json | Bin 250 -> 250 bytes resources/assets/sass/_variables.scss | 14 ++ resources/assets/sass/app.scss | 4 +- resources/assets/sass/components/switch.scss | 152 ++++++++++++++++++ .../views/timeline/partial/new-form.blade.php | 12 +- 7 files changed, 185 insertions(+), 3 deletions(-) create mode 100644 resources/assets/sass/components/switch.scss diff --git a/app/Http/Controllers/StatusController.php b/app/Http/Controllers/StatusController.php index 27cf768f..4e5c2e8d 100644 --- a/app/Http/Controllers/StatusController.php +++ b/app/Http/Controllers/StatusController.php @@ -33,9 +33,11 @@ class StatusController extends Controller $this->validate($request, [ 'photo' => 'required|mimes:jpeg,png,bmp,gif|max:' . config('pixelfed.max_photo_size'), - 'caption' => 'string|max:' . config('pixelfed.max_caption_length') + 'caption' => 'string|max:' . config('pixelfed.max_caption_length'), + 'cw' => 'nullable|string' ]); + $cw = $request->filled('cw') && $request->cw == 'on' ? true : false; $monthHash = hash('sha1', date('Y') . date('m')); $userHash = hash('sha1', $user->id . (string) $user->created_at); $storagePath = "public/m/{$monthHash}/{$userHash}"; @@ -45,6 +47,8 @@ class StatusController extends Controller $status = new Status; $status->profile_id = $profile->id; $status->caption = $request->caption; + $status->is_nsfw = $cw; + $status->save(); $media = new Media; diff --git a/public/css/app.css b/public/css/app.css index 656378808792a6c58533bda671cf2adeefcb083e..4fc774d1919e744b4b6828b87f8a69419855ccb5 100644 GIT binary patch delta 3297 zcma)8TWl0%6waA;w=IyC(r%$ZaZ4?<&|UW0-JLCvifQ7dNEIrHD9rB6wga;}>+F=G zO)W|^Dk{Z3oM<9#X%&lHwiFnmLC_}%MlcfPfkb%m_CjJ*8iK@sF1y`r7bSh@&N=`8 zopZkPoinrd;G7SVbC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=+W%fD1vTIsi)VW^d?3WBBk> ZY)LI
- + Max length: {{config('pixelfed.max_caption_length')}} characters.
+
+ +
+ + +
+ + Please mark all NSFW and controversial content, as per our content policy. + +