Skip to content

Commit

Permalink
Merge pull request #670 from pinkary-project/feat/minor-feed-improvement
Browse files Browse the repository at this point in the history
Feat: minor feed improvement
  • Loading branch information
nunomaduro authored Sep 25, 2024
2 parents 2f573e9 + 242529b commit dacc5f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/Queries/Feeds/QuestionsFollowingFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function builder(): Builder
{
$followQueryClosure = function (Builder $query): void {
$query->where('to_id', $this->user->id)
->orWhereIn('to_id', $this->user->following()->select('users.id'));
->orWhereIn('to_id', DB::table('followers')->select('user_id')->where('follower_id', $this->user->id));
};

return Question::query()
Expand All @@ -36,7 +36,7 @@ public function builder(): Builder
'root as showRoot' => $followQueryClosure,
'parent as showParent' => $followQueryClosure,
])
->with('root.to:username,id', 'root:id,to_id', 'parent:id,parent_id')
->with('root:id,to_id', 'root.to:id,username', 'parent:id,parent_id')
->whereNotNull('answer')
->where('is_reported', false)
->where('is_ignored', false)
Expand Down
26 changes: 13 additions & 13 deletions resources/views/components/thread.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@
:in-thread="true"
:key="'question-'.$rootId"
/>

@if($grandParentId !== null && ($parentId === null || $grandParentId !== $rootId))
<x-post-divider
:link="route('questions.show', ['username' => $username, 'question' => $rootId])"
text="View more comments"
wire:key="divider-{{ $parentId }}"
/>
@else
<x-post-divider wire:key="divider-{{ $parentId }}" />
@endif
@endif

@if ($parentId !== null && $rootId !== $parentId)
@if($rootId !== null)
@if ($grandParentId === $rootId)
<x-post-divider wire:key="divider-{{ $parentId }}" />
@else
<x-post-divider
:link="route('questions.show', ['username' => $username, 'question' => $rootId])"
:text="'View more comments...'"
wire:key="divider-{{ $parentId }}"
/>
@endif
@endif
<livewire:questions.show
:questionId="$parentId"
:in-thread="$rootId !== null"
:key="'question-'.$parentId"
/>
@endif
@if ($parentId !== null || $rootId !== null)

<x-post-divider
wire:key="divider-{{ $questionId }}"
/>
@endif

<livewire:questions.show
:questionId="$questionId"
:in-thread="$rootId !== null || $parentId !== null"
Expand Down

0 comments on commit dacc5f1

Please sign in to comment.