Skip to content

Commit 16f4a50

Browse files
noellaboGargron
authored andcommitted
Fix poll visibility on public pages (mastodon#10817)
* Fix poll visibility on public pages * Revert "Fix poll visibility on public pages" This reverts commit 54a9608. * Revert "Change poll options to alphabetic letters when status text is hidden" This reverts commit c53d673.
1 parent ad64e0a commit 16f4a50

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

app/javascript/mastodon/components/poll.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class Poll extends ImmutablePureComponent {
2828
intl: PropTypes.object.isRequired,
2929
dispatch: PropTypes.func,
3030
disabled: PropTypes.bool,
31-
visible: PropTypes.bool,
3231
};
3332

3433
state = {
@@ -70,14 +69,13 @@ class Poll extends ImmutablePureComponent {
7069
};
7170

7271
renderOption (option, optionIndex) {
73-
const { poll, disabled, visible } = this.props;
74-
const percent = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100;
75-
const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count'));
76-
const active = !!this.state.selected[`${optionIndex}`];
77-
const showResults = poll.get('voted') || poll.get('expired');
72+
const { poll, disabled } = this.props;
73+
const percent = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100;
74+
const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count'));
75+
const active = !!this.state.selected[`${optionIndex}`];
76+
const showResults = poll.get('voted') || poll.get('expired');
7877

7978
let titleEmojified = option.get('title_emojified');
80-
8179
if (!titleEmojified) {
8280
const emojiMap = makeEmojiMap(poll);
8381
titleEmojified = emojify(escapeTextContentForBrowser(option.get('title')), emojiMap);
@@ -106,7 +104,7 @@ class Poll extends ImmutablePureComponent {
106104
{!showResults && <span className={classNames('poll__input', { checkbox: poll.get('multiple'), active })} />}
107105
{showResults && <span className='poll__number'>{Math.round(percent)}%</span>}
108106

109-
{visible ? <span dangerouslySetInnerHTML={{ __html: titleEmojified }} /> : <span>{String.fromCharCode(64 + optionIndex + 1)}</span>}
107+
<span dangerouslySetInnerHTML={{ __html: titleEmojified }} />
110108
</label>
111109
</li>
112110
);

app/javascript/mastodon/components/status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class Status extends ImmutablePureComponent {
317317
}
318318

319319
if (status.get('poll')) {
320-
media = <PollContainer pollId={status.get('poll')} visible={!status.get('hidden')} />;
320+
media = <PollContainer pollId={status.get('poll')} />;
321321
} else if (status.get('media_attachments').size > 0) {
322322
if (this.props.muted) {
323323
media = (

app/javascript/mastodon/features/status/components/detailed_status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
108108
}
109109

110110
if (status.get('poll')) {
111-
media = <PollContainer pollId={status.get('poll')} visible={!status.get('hidden')} />;
111+
media = <PollContainer pollId={status.get('poll')} />;
112112
} else if (status.get('media_attachments').size > 0) {
113113
if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
114114
const video = status.getIn(['media_attachments', 0]);

0 commit comments

Comments
 (0)