Skip to content

Commit

Permalink
fix: update the selected/checked status correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
novacuum committed Apr 9, 2024
1 parent 8d09efd commit 2dffefd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions js/src/forum/components/Poll/PollOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export default class PollOption extends Component<PollOptionAttrs, PollState> {
}

view(): Mithril.Children {
this.voted = this.state.hasVotedFor(this.option);

const isDisabled = this.state.loadingOptions || (this.hasVoted && !this.poll.canChangeVote());
const width = this.canSeeVoteCount ? this.percent() : (Number(this.voted) / (this.poll.myVotes()?.length || 1)) * 100;

Expand Down
2 changes: 0 additions & 2 deletions js/src/forum/components/PollsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type Mithril from 'mithril';
import app from 'flarum/forum/app';
import listItems from 'flarum/common/helpers/listItems';
import ItemList from 'flarum/common/utils/ItemList';
import Page, { IPageAttrs } from 'flarum/common/components/Page';
import IndexPage from 'flarum/forum/components/IndexPage';
import PollList from './Poll/PollList';
import LogInModal from 'flarum/forum/components/LogInModal';
Expand All @@ -11,7 +10,6 @@ import PollListState from '../states/PollListState';
import Button from 'flarum/common/components/Button';
import SelectDropdown from 'flarum/common/components/SelectDropdown';
import LoadingIndicator from 'flarum/common/components/LoadingIndicator';
import PollModel from '../models/Poll';
import PollView from './PollView';
import { AbstractPollPage } from './AbstractPollPage';

Expand Down

0 comments on commit 2dffefd

Please sign in to comment.