Skip to content

Commit

Permalink
Add check for undefined voteCount and update localization strings in …
Browse files Browse the repository at this point in the history
…PollListItem component
  • Loading branch information
novacuum committed Feb 19, 2024
1 parent 0b9216e commit 63a1bee
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 37 deletions.
46 changes: 24 additions & 22 deletions js/dist/forum.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/forum.js.map

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions js/src/forum/components/Poll/PollListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,27 @@ export default class PollListItem<CustomAttrs extends IPollListItemAttrs = IPoll
' ',
active ? t('fof-polls.forum.days_remaining', { time: dayjs(poll.endDate()).fromNow() }) : t('fof-polls.forum.poll_ended'),
]
: icon('fas fa-om');
: [icon('fas fa-om'), ' ', t('fof-polls.forum.poll_never_ends')]

items.add('active', <span className={classList('UserCard-lastSeen', { active })}>{activeView}</span>);

items.add(
'discussion-count',
<div className="userStat">
{icon('fas fa-poll fa-fw')}
{[
' ',
t('fof-user-directory.forum.page.usercard.discussion-count', {
count: abbreviateNumber(poll.voteCount()),
}),
]}
</div>,
70
);
const voteCount = poll.voteCount();
if(voteCount !== undefined){
items.add(
'discussion-count',
<div className="userStat">
{icon('fas fa-poll fa-fw')}
{[
' ',
t('fof-polls.forum.polls_count', {
count: abbreviateNumber(voteCount),
}),
]}
</div>,
70
);
}


return items;
}
Expand Down
3 changes: 3 additions & 0 deletions resources/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ fof-polls:
poll_ended: This poll has ended.
public_poll: View voters
max_votes_allowed: "Poll allows voting for {max, plural, one {# option} other {# options}}."
polls_count: "{count, plural, one { {count} vote} other {{count} votes}}"
poll_never_ends: Poll never ends

poll:
cannot_change_vote: You cannot change your vote after voting.
Expand All @@ -31,6 +33,7 @@ fof-polls:
poll_controls:
edit_label: Edit
delete_label: Delete
view_label: View

poll_form:
delete: Delete Poll
Expand Down

0 comments on commit 63a1bee

Please sign in to comment.