mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update LabsSettings controller
This commit is contained in:
parent
138ce38a5e
commit
0afd048c13
1 changed files with 25 additions and 1 deletions
|
@ -24,7 +24,8 @@ trait LabsSettings {
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'profile_layout' => 'nullable',
|
'profile_layout' => 'nullable',
|
||||||
'dark_mode' => 'nullable',
|
'dark_mode' => 'nullable',
|
||||||
'profile_suggestions' => 'nullable'
|
'profile_suggestions' => 'nullable',
|
||||||
|
'moment_bg' => 'nullable'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$changes = false;
|
$changes = false;
|
||||||
|
@ -60,6 +61,12 @@ trait LabsSettings {
|
||||||
SuggestionService::del($profile->id);
|
SuggestionService::del($profile->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($request->has('moment_bg') && $profile->profile_layout == 'moment') {
|
||||||
|
$bg = in_array($request->input('moment_bg'), $this->momentBackgrounds()) ? $request->input('moment_bg') : 'default';
|
||||||
|
$profile->header_bg = $bg;
|
||||||
|
$changes = true;
|
||||||
|
}
|
||||||
|
|
||||||
if($changes == true) {
|
if($changes == true) {
|
||||||
$profile->save();
|
$profile->save();
|
||||||
}
|
}
|
||||||
|
@ -69,4 +76,21 @@ trait LabsSettings {
|
||||||
->cookie($cookie);
|
->cookie($cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function momentBackgrounds()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'default',
|
||||||
|
'azure',
|
||||||
|
'passion',
|
||||||
|
'reef',
|
||||||
|
'lush',
|
||||||
|
'neon',
|
||||||
|
'flare',
|
||||||
|
'morning',
|
||||||
|
'tranquil',
|
||||||
|
'mauve',
|
||||||
|
'argon',
|
||||||
|
'royal'
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue