forked from mirror/pixelfed
Update SettingsController, add photo_reblogs_only setting
This commit is contained in:
parent
74a6b169d3
commit
dccec7d5a9
1 changed files with 19 additions and 11 deletions
|
@ -240,9 +240,14 @@ class SettingsController extends Controller
|
|||
if(!$userSettings || !$userSettings->other) {
|
||||
$userSettings = [
|
||||
'enable_reblogs' => false,
|
||||
'photo_reblogs_only' => false
|
||||
];
|
||||
} else {
|
||||
$userSettings = $userSettings->other;
|
||||
$userSettings = array_merge([
|
||||
'enable_reblogs' => false,
|
||||
'photo_reblogs_only' => false
|
||||
],
|
||||
$userSettings->other);
|
||||
}
|
||||
return view('settings.timeline', compact('top', 'replies', 'userSettings'));
|
||||
}
|
||||
|
@ -252,7 +257,8 @@ class SettingsController extends Controller
|
|||
$pid = $request->user()->profile_id;
|
||||
$uid = $request->user()->id;
|
||||
$this->validate($request, [
|
||||
'enable_reblogs' => 'sometimes'
|
||||
'enable_reblogs' => 'sometimes',
|
||||
'photo_reblogs_only' => 'sometimes'
|
||||
]);
|
||||
Redis::zrem('pf:tl:top', $pid);
|
||||
Redis::zrem('pf:tl:replies', $pid);
|
||||
|
@ -262,8 +268,10 @@ class SettingsController extends Controller
|
|||
if($userSettings->other) {
|
||||
$other = $userSettings->other;
|
||||
$other['enable_reblogs'] = $request->has('enable_reblogs');
|
||||
$other['photo_reblogs_only'] = $request->has('photo_reblogs_only');
|
||||
} else {
|
||||
$other['enable_reblogs'] = $request->has('enable_reblogs');
|
||||
$other['photo_reblogs_only'] = $request->has('photo_reblogs_only');
|
||||
}
|
||||
$userSettings->other = $other;
|
||||
$userSettings->save();
|
||||
|
|
Loading…
Reference in a new issue