mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-25 22:10:47 +00:00
Update SettingsController
This commit is contained in:
parent
0508900b46
commit
d8d73298a9
1 changed files with 61 additions and 0 deletions
|
@ -7,6 +7,7 @@ use App\EmailVerification;
|
||||||
use App\Media;
|
use App\Media;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
use App\User;
|
use App\User;
|
||||||
|
use App\UserFilter;
|
||||||
use App\Util\Lexer\PrettyNumber;
|
use App\Util\Lexer\PrettyNumber;
|
||||||
use Auth;
|
use Auth;
|
||||||
use DB;
|
use DB;
|
||||||
|
@ -254,4 +255,64 @@ class SettingsController extends Controller
|
||||||
{
|
{
|
||||||
return view('settings.developers');
|
return view('settings.developers');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function mutedUsers()
|
||||||
|
{
|
||||||
|
$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'
|
||||||
|
]);
|
||||||
|
$fid = $request->input('profile_id');
|
||||||
|
$pid = Auth::user()->profile->id;
|
||||||
|
DB::transaction(function () use ($fid, $pid) {
|
||||||
|
$filter = UserFilter::whereUserId($pid)
|
||||||
|
->whereFilterableId($fid)
|
||||||
|
->whereFilterableType('App\Profile')
|
||||||
|
->whereFilterType('mute')
|
||||||
|
->firstOrFail();
|
||||||
|
$filter->delete();
|
||||||
|
});
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function blockedUsers()
|
||||||
|
{
|
||||||
|
$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'
|
||||||
|
]);
|
||||||
|
$fid = $request->input('profile_id');
|
||||||
|
$pid = Auth::user()->profile->id;
|
||||||
|
DB::transaction(function () use ($fid, $pid) {
|
||||||
|
$filter = UserFilter::whereUserId($pid)
|
||||||
|
->whereFilterableId($fid)
|
||||||
|
->whereFilterableType('App\Profile')
|
||||||
|
->whereFilterType('block')
|
||||||
|
->firstOrFail();
|
||||||
|
$filter->delete();
|
||||||
|
});
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function blockedInstances()
|
||||||
|
{
|
||||||
|
$settings = Auth::user()->settings;
|
||||||
|
return view('settings.privacy.blocked-instances');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue