mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-24 23:35:23 +00:00
Update PrivacySettings controller, refresh RelationshipService when unmute/unblocking
This commit is contained in:
parent
8c6936409d
commit
b7322b6874
1 changed files with 40 additions and 39 deletions
|
@ -2,23 +2,17 @@
|
|||
|
||||
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;
|
||||
use App\Services\RelationshipService;
|
||||
use App\UserFilter;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use App\Util\ActivityPub\Helpers;
|
||||
use Auth, Cache, DB;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\UserDomainBlock;
|
||||
|
||||
trait PrivacySettings
|
||||
{
|
||||
|
||||
public function privacy()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
@ -97,6 +91,7 @@ trait PrivacySettings
|
|||
Cache::forget('pf:acct-trans:hideFollowers:'.$pid);
|
||||
Cache::forget('pfc:cached-user:wt:'.strtolower($profile->username));
|
||||
Cache::forget('pfc:cached-user:wot:'.strtolower($profile->username));
|
||||
|
||||
return redirect(route('settings.privacy'))->with('status', 'Settings successfully updated!');
|
||||
}
|
||||
|
||||
|
@ -105,13 +100,14 @@ trait PrivacySettings
|
|||
$pid = Auth::user()->profile->id;
|
||||
$ids = (new UserFilter())->mutedUserIds($pid);
|
||||
$users = Profile::whereIn('id', $ids)->simplePaginate(15);
|
||||
|
||||
return view('settings.privacy.muted', compact('users'));
|
||||
}
|
||||
|
||||
public function mutedUsersUpdate(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'profile_id' => 'required|integer|min:1'
|
||||
'profile_id' => 'required|integer|min:1',
|
||||
]);
|
||||
$fid = $request->input('profile_id');
|
||||
$pid = Auth::user()->profile->id;
|
||||
|
@ -123,6 +119,8 @@ trait PrivacySettings
|
|||
->firstOrFail();
|
||||
$filter->delete();
|
||||
});
|
||||
RelationshipService::refresh($pid, $fid);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
@ -131,14 +129,14 @@ trait PrivacySettings
|
|||
$pid = Auth::user()->profile->id;
|
||||
$ids = (new UserFilter())->blockedUserIds($pid);
|
||||
$users = Profile::whereIn('id', $ids)->simplePaginate(15);
|
||||
|
||||
return view('settings.privacy.blocked', compact('users'));
|
||||
}
|
||||
|
||||
|
||||
public function blockedUsersUpdate(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'profile_id' => 'required|integer|min:1'
|
||||
'profile_id' => 'required|integer|min:1',
|
||||
]);
|
||||
$fid = $request->input('profile_id');
|
||||
$pid = Auth::user()->profile->id;
|
||||
|
@ -150,6 +148,8 @@ trait PrivacySettings
|
|||
->firstOrFail();
|
||||
$filter->delete();
|
||||
});
|
||||
RelationshipService::refresh($pid, $fid);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ trait PrivacySettings
|
|||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
// code...
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -221,6 +221,7 @@ trait PrivacySettings
|
|||
$settings->save();
|
||||
$profile->save();
|
||||
Cache::forget('profiles:private');
|
||||
|
||||
return [200];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue