Merge pull request #4566 from pixelfed/staging

Add Photo reblogs only setting
This commit is contained in:
daniel 2023-07-30 06:35:18 -06:00 committed by GitHub
commit 5cdf076527
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 11 deletions

View file

@ -48,6 +48,7 @@
- Update StatusStatelessTransformer, allow unlisted reblogs ([1c13b518](https://github.com/pixelfed/pixelfed/commit/1c13b518)) - 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 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 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/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.8 (2023-05-29)](https://github.com/pixelfed/pixelfed/compare/v0.11.7...v0.11.8) ## [v0.11.8 (2023-05-29)](https://github.com/pixelfed/pixelfed/compare/v0.11.7...v0.11.8)

View file

@ -231,43 +231,51 @@ class SettingsController extends Controller
public function timelineSettings(Request $request) public function timelineSettings(Request $request)
{ {
$uid = $request->user()->id; $uid = $request->user()->id;
$pid = $request->user()->profile_id; $pid = $request->user()->profile_id;
$top = Redis::zscore('pf:tl:top', $pid) != false; $top = Redis::zscore('pf:tl:top', $pid) != false;
$replies = Redis::zscore('pf:tl:replies', $pid) != false; $replies = Redis::zscore('pf:tl:replies', $pid) != false;
$userSettings = UserSetting::firstOrCreate([ $userSettings = UserSetting::firstOrCreate([
'user_id' => $uid 'user_id' => $uid
]); ]);
if(!$userSettings || !$userSettings->other) { if(!$userSettings || !$userSettings->other) {
$userSettings = [ $userSettings = [
'enable_reblogs' => false, 'enable_reblogs' => false,
'photo_reblogs_only' => false
]; ];
} else { } 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) public function updateTimelineSettings(Request $request)
{ {
$pid = $request->user()->profile_id; $pid = $request->user()->profile_id;
$uid = $request->user()->id; $uid = $request->user()->id;
$this->validate($request, [ $this->validate($request, [
'enable_reblogs' => 'sometimes' 'enable_reblogs' => 'sometimes',
'photo_reblogs_only' => 'sometimes'
]); ]);
Redis::zrem('pf:tl:top', $pid); Redis::zrem('pf:tl:top', $pid);
Redis::zrem('pf:tl:replies', $pid); Redis::zrem('pf:tl:replies', $pid);
$userSettings = UserSetting::firstOrCreate([ $userSettings = UserSetting::firstOrCreate([
'user_id' => $uid 'user_id' => $uid
]); ]);
if($userSettings->other) { if($userSettings->other) {
$other = $userSettings->other; $other = $userSettings->other;
$other['enable_reblogs'] = $request->has('enable_reblogs'); $other['enable_reblogs'] = $request->has('enable_reblogs');
$other['photo_reblogs_only'] = $request->has('photo_reblogs_only');
} else { } else {
$other['enable_reblogs'] = $request->has('enable_reblogs'); $other['enable_reblogs'] = $request->has('enable_reblogs');
$other['photo_reblogs_only'] = $request->has('photo_reblogs_only');
} }
$userSettings->other = $other; $userSettings->other = $other;
$userSettings->save(); $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) public function mediaSettings(Request $request)

Binary file not shown.

BIN
public/js/home.chunk.f5594d49a6bead99.js vendored Normal file

Binary file not shown.

BIN
public/js/manifest.js vendored

Binary file not shown.

Binary file not shown.

View file

@ -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> <p class="text-muted small help-text">See reblogs from accounts you follow in your home feed. (Home timeline only)</p>
</div> </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="form-group row mt-5 pt-5">
<div class="col-12 text-right"> <div class="col-12 text-right">
<hr> <hr>