Skip to content

Commit

Permalink
fix current user vote on showcase page
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Mar 7, 2024
1 parent f2a1760 commit 4919682
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/src/forum/components/PollsShowcasePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class PollsShowcasePage extends AbstractPollPage {
this.state = new PollListState({
sort: m.route.param('sort'),
filter: m.route.param('filter'),
include: ['options', 'votes', 'myVotes'],
include: ['options', 'votes', 'myVotes', 'myVotes.option'],
});

this.state.refresh();
Expand Down
4 changes: 1 addition & 3 deletions src/Api/Controllers/ListGlobalPollsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public function __construct(PollRepository $polls, UrlGenerator $url)

public function data(ServerRequestInterface $request, Document $document): Collection
{
$actor = RequestUtil::getActor($request);

// Not yet needed, but here if/when we do.
// $filters = $this->extractFilter($request);
$sort = $this->extractSort($request);
Expand All @@ -60,7 +58,7 @@ public function data(ServerRequestInterface $request, Document $document): Colle
$offset = $this->extractOffset($request);
$include = $this->extractInclude($request);

$results = $this->polls->queryVisibleTo($actor)
$results = $this->polls->queryVisibleTo(RequestUtil::getActor($request))
->select('polls.*')
->whereNull('post_id')
->orderBy($sortIsDefault ? 'id' : $sort, 'desc')
Expand Down

0 comments on commit 4919682

Please sign in to comment.