From 05169061839bfefcb083cb610b7bda8d4d9e68e8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 25 Jun 2019 21:18:30 -0600 Subject: [PATCH 1/4] Update MentionPipeline, prevent duplicate notifications for comments/mentions --- app/Jobs/MentionPipeline/MentionPipeline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/MentionPipeline/MentionPipeline.php b/app/Jobs/MentionPipeline/MentionPipeline.php index e75ede04..ea833345 100644 --- a/app/Jobs/MentionPipeline/MentionPipeline.php +++ b/app/Jobs/MentionPipeline/MentionPipeline.php @@ -50,7 +50,7 @@ class MentionPipeline implements ShouldQueue $exists = Notification::whereProfileId($target) ->whereActorId($actor->id) - ->whereAction('mention') + ->whereIn('action', ['mention', 'comment']) ->whereItemId($status->id) ->whereItemType('App\Status') ->count(); From d34224f21612b8affb65e09941a24346aa187043 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 26 Jun 2019 19:58:39 -0600 Subject: [PATCH 2/4] Update PrivacySettings --- .../Controllers/Settings/PrivacySettings.php | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/app/Http/Controllers/Settings/PrivacySettings.php b/app/Http/Controllers/Settings/PrivacySettings.php index 8e987ab6..99f7d410 100644 --- a/app/Http/Controllers/Settings/PrivacySettings.php +++ b/app/Http/Controllers/Settings/PrivacySettings.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Settings; use App\AccountLog; use App\EmailVerification; use App\Instance; +use App\Follower; use App\Media; use App\Profile; use App\User; @@ -170,4 +171,47 @@ trait PrivacySettings { return view('settings.privacy.blocked-keywords'); } + + public function privateAccountOptions(Request $request) + { + $this->validate($request, [ + 'mode' => 'required|string|in:keep-all,mutual-only,only-followers,remove-all', + 'duration' => 'required|integer|min:60|max:525600', + ]); + $mode = $request->input('mode'); + $duration = $request->input('duration'); + // $newRequests = $request->input('newrequests'); + + $profile = Auth::user()->profile; + $settings = Auth::user()->settings; + + if($mode !== 'keep-all') { + switch ($mode) { + case 'mutual-only': + $following = $profile->following()->pluck('profiles.id'); + Follower::whereFollowingId($profile->id)->whereNotIn('profile_id', $following)->delete(); + break; + + case 'only-followers': + $ts = now()->subMinutes($duration); + Follower::whereFollowingId($profile->id)->where('created_at', '>', $ts)->delete(); + break; + + case 'remove-all': + Follower::whereFollowingId($profile->id)->delete(); + break; + + default: + # code... + break; + } + } + $profile->is_private = true; + $settings->show_guests = false; + $settings->show_discover = false; + $settings->save(); + $profile->save(); + Cache::forget('profiles:private'); + return [200]; + } } \ No newline at end of file From 5b768c1090cec2d4ffdbff6ae9a58b2701031cf5 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 26 Jun 2019 20:03:24 -0600 Subject: [PATCH 3/4] Update privacy settings view --- resources/views/settings/privacy.blade.php | 141 ++++++++++++++++++++- 1 file changed, 139 insertions(+), 2 deletions(-) diff --git a/resources/views/settings/privacy.blade.php b/resources/views/settings/privacy.blade.php index cff620c9..584529f4 100644 --- a/resources/views/settings/privacy.blade.php +++ b/resources/views/settings/privacy.blade.php @@ -10,10 +10,15 @@

Muted Users Blocked Users + Blocked keywords + Blocked instances

@csrf + + +
is_private ? 'checked=""':''}}>
+ + {{--
+ is_private ? 'disabled=""':''}} {{$settings->show_discover ? 'checked=""':''}}> + +

When this option is enabled, your profile and posts are used for discover recommendations. Only public profiles and posts are used.

+
--}} + {{--
+ + +

If selected, you will be able to receive messages from any user even if you do not follow them.

+
--}} + {{--
+ + +

This prevents posts with potentially sensitive content from displaying in your search results.

+
--}} + {{--
+ + +

Use this to eliminate search results from accounts you've blocked or muted.

+
+
+ + +

Show all media, including potentially sensitive content.

+
--}} +
show_profile_follower_count ? 'checked=""':''}}>