mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Merge pull request #4566 from pixelfed/staging
Add Photo reblogs only setting
This commit is contained in:
commit
5cdf076527
8 changed files with 26 additions and 11 deletions
|
@ -48,6 +48,7 @@
|
|||
- Update StatusStatelessTransformer, allow unlisted reblogs ([1c13b518](https://github.com/pixelfed/pixelfed/commit/1c13b518))
|
||||
- Update ApiV1Controller, hydrate reblog state in home timeline ([13bdaa2e](https://github.com/pixelfed/pixelfed/commit/13bdaa2e))
|
||||
- Update Timeline component, improve reblog support ([29de91e5](https://github.com/pixelfed/pixelfed/commit/29de91e5))
|
||||
- Update timeline settings, add photo reblogs only option ([e2705b9a](https://github.com/pixelfed/pixelfed/commit/e2705b9a))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.11.8 (2023-05-29)](https://github.com/pixelfed/pixelfed/compare/v0.11.7...v0.11.8)
|
||||
|
|
|
@ -231,43 +231,51 @@ class SettingsController extends Controller
|
|||
public function timelineSettings(Request $request)
|
||||
{
|
||||
$uid = $request->user()->id;
|
||||
$pid = $request->user()->profile_id;
|
||||
$top = Redis::zscore('pf:tl:top', $pid) != false;
|
||||
$replies = Redis::zscore('pf:tl:replies', $pid) != false;
|
||||
$pid = $request->user()->profile_id;
|
||||
$top = Redis::zscore('pf:tl:top', $pid) != false;
|
||||
$replies = Redis::zscore('pf:tl:replies', $pid) != false;
|
||||
$userSettings = UserSetting::firstOrCreate([
|
||||
'user_id' => $uid
|
||||
]);
|
||||
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'));
|
||||
return view('settings.timeline', compact('top', 'replies', 'userSettings'));
|
||||
}
|
||||
|
||||
public function updateTimelineSettings(Request $request)
|
||||
{
|
||||
$pid = $request->user()->profile_id;
|
||||
$uid = $request->user()->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);
|
||||
Redis::zrem('pf:tl:top', $pid);
|
||||
Redis::zrem('pf:tl:replies', $pid);
|
||||
$userSettings = UserSetting::firstOrCreate([
|
||||
'user_id' => $uid
|
||||
]);
|
||||
if($userSettings->other) {
|
||||
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();
|
||||
return redirect(route('settings'))->with('status', 'Timeline settings successfully updated!');
|
||||
return redirect(route('settings'))->with('status', 'Timeline settings successfully updated!');
|
||||
}
|
||||
|
||||
public function mediaSettings(Request $request)
|
||||
|
|
BIN
public/js/home.chunk.e9ae8285416aa78f.js
vendored
BIN
public/js/home.chunk.e9ae8285416aa78f.js
vendored
Binary file not shown.
BIN
public/js/home.chunk.f5594d49a6bead99.js
vendored
Normal file
BIN
public/js/home.chunk.f5594d49a6bead99.js
vendored
Normal file
Binary file not shown.
BIN
public/js/manifest.js
vendored
BIN
public/js/manifest.js
vendored
Binary file not shown.
Binary file not shown.
|
@ -25,6 +25,12 @@
|
|||
<p class="text-muted small help-text">See reblogs from accounts you follow in your home feed. (Home timeline only)</p>
|
||||
</div>
|
||||
|
||||
<div class="form-check pb-3">
|
||||
<input class="form-check-input" type="checkbox" name="photo_reblogs_only" {{$userSettings['photo_reblogs_only'] ? 'checked':''}}>
|
||||
<label class="form-check-label font-weight-bold" for="">Photo reblogs only</label>
|
||||
<p class="text-muted small help-text">Only see reblogs of photos or photo albums. (Home timeline only)</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group row mt-5 pt-5">
|
||||
<div class="col-12 text-right">
|
||||
<hr>
|
||||
|
|
Loading…
Reference in a new issue