From 5373e7b43501750969f88f2b9e8eeaa8b548effa Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 25 Apr 2019 23:24:25 -0600 Subject: [PATCH 01/20] Update config --- config/exp.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/exp.php b/config/exp.php index 8bd0cf2ab..8101428c3 100644 --- a/config/exp.php +++ b/config/exp.php @@ -2,6 +2,7 @@ return [ - 'lc' => env('EXP_LC', false) + 'lc' => env('EXP_LC', false), + 'rec' => env('EXP_REC', false) ]; \ No newline at end of file From 9b357188e416b4488f6a32fa2f5823440ea35fb9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 25 Apr 2019 23:24:59 -0600 Subject: [PATCH 02/20] Update ApiController --- app/Http/Controllers/ApiController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index 42b0dc93b..dd53d2a25 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -39,7 +39,8 @@ class ApiController extends BaseApiController ], 'ab' => [ - 'lc' => config('exp.lc') + 'lc' => config('exp.lc'), + 'rec' => config('exp.rec'), ], ]; }); From 9174e0e377eb2736452fe5695fffe928d92e04e2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 27 Apr 2019 20:52:37 -0600 Subject: [PATCH 03/20] Add new migration --- ...4733_add_suggestions_to_profiles_table.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 database/migrations/2019_04_28_024733_add_suggestions_to_profiles_table.php diff --git a/database/migrations/2019_04_28_024733_add_suggestions_to_profiles_table.php b/database/migrations/2019_04_28_024733_add_suggestions_to_profiles_table.php new file mode 100644 index 000000000..f5fe2d25e --- /dev/null +++ b/database/migrations/2019_04_28_024733_add_suggestions_to_profiles_table.php @@ -0,0 +1,32 @@ +boolean('is_suggestable')->default(false)->index(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('profiles', function (Blueprint $table) { + $table->dropColumn('is_suggestable'); + }); + } +} From 95b75cc5fc7d28aa4d0904253a20d59a39048a74 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 27 Apr 2019 23:04:46 -0600 Subject: [PATCH 04/20] Update settings view --- resources/views/settings/dataexport.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/settings/dataexport.blade.php b/resources/views/settings/dataexport.blade.php index c6fa43868..8351a7c9b 100644 --- a/resources/views/settings/dataexport.blade.php +++ b/resources/views/settings/dataexport.blade.php @@ -6,7 +6,7 @@

Data Export


-
We generate data exports once per hour, and they may not contain the latest data if you've requested them recently.
+
We generate data exports once per hour, and they may not contain the latest data if you've requested them recently.
  • From ed4838d248dd46b87626feb7a7b4659fa1b849fe Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 27 Apr 2019 23:19:41 -0600 Subject: [PATCH 05/20] Update settings template --- resources/views/settings/template.blade.php | 26 ++++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/resources/views/settings/template.blade.php b/resources/views/settings/template.blade.php index 3d62a90ca..19656b274 100644 --- a/resources/views/settings/template.blade.php +++ b/resources/views/settings/template.blade.php @@ -1,6 +1,18 @@ @extends('layouts.app') @section('content') +@if (session('status')) +
    + {{ session('status') }} +
    +@endif +@if ($errors->any()) +
    + @foreach($errors->all() as $error) +

    {{ $error }}

  • + @endforeach + +@endif
    @@ -9,20 +21,6 @@
    @include('settings.partial.sidebar')
    - @if (session('status')) -
    - {{ session('status') }} -
    - @endif - @if (session('errors')) -
    -
      - @foreach (session('errors') as $error) -
    • {{ $error }}
    • - @endforeach -
    -
    - @endif @yield('section')
    From f0ce2a43353c6f47aea00c0b7528541b2f599ce9 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 28 Apr 2019 16:38:23 -0600 Subject: [PATCH 06/20] Add SuggestionService --- app/Services/SuggestionService.php | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 app/Services/SuggestionService.php diff --git a/app/Services/SuggestionService.php b/app/Services/SuggestionService.php new file mode 100644 index 000000000..a4d6b8d23 --- /dev/null +++ b/app/Services/SuggestionService.php @@ -0,0 +1,46 @@ +whereIsSuggestable(true)->pluck('id'); + foreach($ids as $id) { + self::set($id); + } + } + } +} \ No newline at end of file From e3b9fb759ccdb21011c6eaea5f817d66b5b24bf8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 28 Apr 2019 16:38:55 -0600 Subject: [PATCH 07/20] Update HomeSettings --- app/Http/Controllers/Settings/HomeSettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Settings/HomeSettings.php b/app/Http/Controllers/Settings/HomeSettings.php index 2dfa0de38..9b4656bac 100644 --- a/app/Http/Controllers/Settings/HomeSettings.php +++ b/app/Http/Controllers/Settings/HomeSettings.php @@ -41,7 +41,7 @@ trait HomeSettings ]); $changes = false; - $name = strip_tags($request->input('name')); + $name = strip_tags(Purify::clean($request->input('name'))); $bio = $request->filled('bio') ? strip_tags(Purify::clean($request->input('bio'))) : null; $website = $request->input('website'); $email = $request->input('email'); From 89461213340e657d9f268d92fce1808bcffd7eb4 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 28 Apr 2019 16:39:26 -0600 Subject: [PATCH 08/20] Add LabsSettings controller --- .../Controllers/Settings/LabsSettings.php | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 app/Http/Controllers/Settings/LabsSettings.php diff --git a/app/Http/Controllers/Settings/LabsSettings.php b/app/Http/Controllers/Settings/LabsSettings.php new file mode 100644 index 000000000..f0020b570 --- /dev/null +++ b/app/Http/Controllers/Settings/LabsSettings.php @@ -0,0 +1,83 @@ +middleware('auth'); + } + + public function labs(Request $request) + { + $profile = $request->user()->profile; + return view('settings.labs', compact('profile')); + } + + public function labsStore(Request $request) + { + $this->validate($request, [ + 'profile_layout' => 'nullable', + 'dark_mode' => 'nullable', + 'profile_suggestions' => 'nullable' + ]); + + $changes = false; + + $profile = $request->user()->profile; + + $cookie = Cookie::forget('dark-mode'); + if($request->has('dark_mode') && $profile->profile_layout != 'moment') { + if($request->dark_mode == 'on') { + $cookie = Cookie::make('dark-mode', true, 43800); + } + } + + if($request->has('profile_layout')) { + if($profile->profile_layout != 'moment') { + $profile->profile_layout = 'moment'; + $changes = true; + } else { + $profile->profile_layout = null; + $changes = true; + } + } else { + if($profile->profile_layout == 'moment') { + $profile->profile_layout = null; + $changes = true; + } + } + + if($request->has('profile_suggestions')) { + if($profile->is_suggestable == false) { + $profile->is_suggestable = true; + $changes = true; + SuggestionService::set($profile->id); + } else { + $profile->is_suggestable = false; + $changes = true; + SuggestionService::del($profile->id); + } + } else { + if($profile->is_suggestable == true) { + $profile->is_suggestable = false; + $changes = true; + SuggestionService::del($profile->id); + } + } + + if($changes == true) { + $profile->save(); + } + + return redirect(route('settings.labs')) + ->with('status', 'Labs preferences successfully updated!') + ->cookie($cookie); + } + +} \ No newline at end of file From d72876bd149d4052134a17bd84a9e91c22d63a5d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 28 Apr 2019 16:49:37 -0600 Subject: [PATCH 09/20] Update settings sidebar --- .../views/settings/partial/sidebar.blade.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/resources/views/settings/partial/sidebar.blade.php b/resources/views/settings/partial/sidebar.blade.php index 2265f3054..329f672c0 100644 --- a/resources/views/settings/partial/sidebar.blade.php +++ b/resources/views/settings/partial/sidebar.blade.php @@ -6,6 +6,26 @@ + {{-- + + + @if(config('pixelfed.user_invites.enabled')) + + @endif + + + --}} + @@ -15,8 +35,27 @@ + {{-- --}} + {{-- + + + --}} + +
\ No newline at end of file From ac40a6d8a9202441acf07faa2fbe9fd91257ea16 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 28 Apr 2019 16:53:21 -0600 Subject: [PATCH 10/20] Add labs settings page --- resources/views/settings/labs.blade.php | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 resources/views/settings/labs.blade.php diff --git a/resources/views/settings/labs.blade.php b/resources/views/settings/labs.blade.php new file mode 100644 index 000000000..270bdf364 --- /dev/null +++ b/resources/views/settings/labs.blade.php @@ -0,0 +1,63 @@ + @extends('settings.template') + + @section('section') +
+

Labs

+

Experimental features

+
+
+
+ Warning: Some experimental features may contain bugs or missing functionality +
+
+

UI

+
+
+
+ @csrf + @if(config('exp.lc') == true) +
+ + +

Like counts are hidden on timelines. This experiment was enabled for all users and can only be changed by the instance administrator.

+
+ @endif +
+ profile_layout == 'moment' ? 'checked':''}} value="{{$profile->profile_layout}}"> + +

MomentUI offers an alternative layout for posts and your profile.

+
+ @if($profile->profile_layout != 'moment') +
+ hasCookie('dark-mode') ? 'checked':''}}> + +

Use dark mode theme.

+
+ @endif +
+

Discovery

+
+
+ @if(config('exp.rec') == true) +
+ is_suggestable ? 'checked' : ''}}> + +

Allow your profile to be listed in Profile Suggestions.

+
+ @endif +
+
+
+ +
+
+
+ @endsection \ No newline at end of file From ac4a72bc9d51fd2593c2e1fba66850777d19b875 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 28 Apr 2019 16:58:28 -0600 Subject: [PATCH 11/20] Update settings home page --- resources/views/settings/home.blade.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/resources/views/settings/home.blade.php b/resources/views/settings/home.blade.php index 3038dce7f..181f21c46 100644 --- a/resources/views/settings/home.blade.php +++ b/resources/views/settings/home.blade.php @@ -101,19 +101,7 @@

Layout

-
- -
-
- profile->profile_layout != 'moment' ? 'checked':''}} value="metro"> - -
-
- profile->profile_layout == 'moment' ? 'checked':''}} value="moment"> - -
-
-
+
Experimental features have been moved to the Labs settings page.

@if(config('pixelfed.account_deletion') == true)
From b98c7f849e8b439d799cf281bbb4311bb91e82cb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 28 Apr 2019 17:01:10 -0600 Subject: [PATCH 12/20] Update Timeline component --- resources/assets/js/components/Timeline.vue | 55 +++++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index db52aa34a..0dd8c1a05 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -213,10 +213,7 @@

BETA FEATURES

-
- - -
+
Experimental features have been moved to the Labs settings page.
@@ -225,6 +222,31 @@ +
+
+
+
Suggestions For You
+
+
+
+
+ + + +
+

+ + {{rec.username}} + +

+

{{rec.message}}

+
+ Follow +
+
+
+
+