mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update StoryController, fix postgres bug. Fixes #2904
This commit is contained in:
parent
32995064ec
commit
00c32360ae
1 changed files with 22 additions and 7 deletions
|
@ -36,13 +36,28 @@ class StoryController extends StoryComposeController
|
||||||
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
|
||||||
$pid = $request->user()->profile_id;
|
$pid = $request->user()->profile_id;
|
||||||
|
|
||||||
$s = Story::select('stories.*', 'followers.following_id')
|
if(config('database.default') == 'pgsql') {
|
||||||
->leftJoin('followers', 'followers.following_id', 'stories.profile_id')
|
$s = 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)
|
||||||
->groupBy('followers.following_id')
|
->where('stories.active', true)
|
||||||
->orderByDesc('id')
|
->get()
|
||||||
->get();
|
->map(function($s) {
|
||||||
|
$r = new \StdClass;
|
||||||
|
$r->id = $s->id;
|
||||||
|
$r->profile_id = $s->profile_id;
|
||||||
|
return $r;
|
||||||
|
})
|
||||||
|
->unique('profile_id');
|
||||||
|
} else {
|
||||||
|
$s = 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();
|
||||||
|
}
|
||||||
|
|
||||||
$res = $s->map(function($s) use($pid) {
|
$res = $s->map(function($s) use($pid) {
|
||||||
$profile = AccountService::get($s->profile_id);
|
$profile = AccountService::get($s->profile_id);
|
||||||
|
|
Loading…
Reference in a new issue