Merge pull request #4355 from pixelfed/staging

Staging
This commit is contained in:
daniel 2023-05-05 06:45:06 -06:00 committed by GitHub
commit e4db35c6dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 19 deletions

View file

@ -6,6 +6,7 @@
- Update admin dashboard, fix search and dropdown menu ([dac0d083](https://github.com/pixelfed/pixelfed/commit/dac0d083)) - Update admin dashboard, fix search and dropdown menu ([dac0d083](https://github.com/pixelfed/pixelfed/commit/dac0d083))
- Update sudo mode view, fix trusted device checkbox ([8ef900bf](https://github.com/pixelfed/pixelfed/commit/8ef900bf)) - Update sudo mode view, fix trusted device checkbox ([8ef900bf](https://github.com/pixelfed/pixelfed/commit/8ef900bf))
- Update SearchApiV2Service, improve postgres support ([666e5732](https://github.com/pixelfed/pixelfed/commit/666e5732)) - Update SearchApiV2Service, improve postgres support ([666e5732](https://github.com/pixelfed/pixelfed/commit/666e5732))
- Update StoryController, show active self stories on home timeline ([633351f6](https://github.com/pixelfed/pixelfed/commit/633351f6))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.6 (2023-05-03)](https://github.com/pixelfed/pixelfed/compare/v0.11.5...v0.11.6) ## [v0.11.6 (2023-05-03)](https://github.com/pixelfed/pixelfed/compare/v0.11.5...v0.11.6)

View file

@ -37,28 +37,53 @@ class StoryController extends StoryComposeController
$pid = $request->user()->profile_id; $pid = $request->user()->profile_id;
if(config('database.default') == 'pgsql') { if(config('database.default') == 'pgsql') {
$s = Story::select('stories.*', 'followers.following_id') $s = Cache::remember('pf:stories:recent-by-id:' . $pid, 900, function() use($pid) {
->leftJoin('followers', 'followers.following_id', 'stories.profile_id') return Story::select('stories.*', 'followers.following_id')
->where('followers.profile_id', $pid) ->leftJoin('followers', 'followers.following_id', 'stories.profile_id')
->where('stories.active', true) ->where('followers.profile_id', $pid)
->where('stories.active', true)
->get()
->map(function($s) {
$r = new \StdClass;
$r->id = $s->id;
$r->profile_id = $s->profile_id;
$r->type = $s->type;
$r->path = $s->path;
return $r;
})
->unique('profile_id');
});
} else {
$s = Cache::remember('pf:stories:recent-by-id:' . $pid, 900, function() use($pid) {
return Story::select('stories.*', 'followers.following_id')
->leftJoin('followers', 'followers.following_id', 'stories.profile_id')
->where('followers.profile_id', $pid)
->where('stories.active', true)
->groupBy('followers.following_id')
->orderByDesc('id')
->get();
});
}
$self = Cache::remember('pf:stories:recent-self:' . $pid, 21600, function() use($pid) {
return Story::whereProfileId($pid)
->whereActive(true)
->orderByDesc('id')
->limit(1)
->get() ->get()
->map(function($s) { ->map(function($s) use($pid) {
$r = new \StdClass; $r = new \StdClass;
$r->id = $s->id; $r->id = $s->id;
$r->profile_id = $s->profile_id; $r->profile_id = $pid;
$r->type = $s->type; $r->type = $s->type;
$r->path = $s->path; $r->path = $s->path;
return $r; return $r;
}) });
->unique('profile_id'); });
} else {
$s = Story::select('stories.*', 'followers.following_id') if($self->count()) {
->leftJoin('followers', 'followers.following_id', 'stories.profile_id') $s->prepend($self->first());
->where('followers.profile_id', $pid)
->where('stories.active', true)
->groupBy('followers.following_id')
->orderByDesc('id')
->get();
} }
$res = $s->map(function($s) use($pid) { $res = $s->map(function($s) use($pid) {
@ -93,7 +118,7 @@ class StoryController extends StoryComposeController
$profile = Profile::findOrFail($id); $profile = Profile::findOrFail($id);
if($authed != $profile->id && !FollowerService::follows($authed, $profile->id)) { if($authed != $profile->id && !FollowerService::follows($authed, $profile->id)) {
return []; return abort([], 403);
} }
$stories = Story::whereProfileId($profile->id) $stories = Story::whereProfileId($profile->id)
@ -164,7 +189,6 @@ class StoryController extends StoryComposeController
$publicOnly = (bool) $profile->followedBy($authed); $publicOnly = (bool) $profile->followedBy($authed);
abort_if(!$publicOnly, 403); abort_if(!$publicOnly, 403);
$v = StoryView::firstOrCreate([ $v = StoryView::firstOrCreate([
'story_id' => $id, 'story_id' => $id,
'profile_id' => $authed->id 'profile_id' => $authed->id

View file

@ -95,7 +95,8 @@ class StoryService
public static function delLatest($pid) public static function delLatest($pid)
{ {
return Cache::forget(self::STORY_KEY . 'latest:pid-' . $pid); Cache::forget(self::STORY_KEY . 'latest:pid-' . $pid);
return Cache::forget('pf:stories:recent-self:' . $pid);
} }
public static function addSeen($pid, $sid) public static function addSeen($pid, $sid)

Binary file not shown.

BIN
public/js/home.chunk.25bd77760873ee83.js vendored Normal file

Binary file not shown.

BIN
public/js/manifest.js vendored

Binary file not shown.

Binary file not shown.