]> cat aescling's git repositories - mastodon.git/commitdiff
Fix poll visibility on public pages (#10817)
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Sun, 26 May 2019 21:13:29 +0000 (06:13 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 26 May 2019 21:13:29 +0000 (23:13 +0200)
* Fix poll visibility on public pages

* Revert "Fix poll visibility on public pages"

This reverts commit 54a9608add6f855bc6337fe3c65eaee7ba13db49.

* Revert "Change poll options to alphabetic letters when status text is hidden"

This reverts commit c53d67326201b2061990b1874a3547c3647f50d2.

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

index acab107a165e1ab30f6c2d2777e3024fcb599e89..690f9ae5a076da1169b18314d9315adeb024357f 100644 (file)
@@ -28,7 +28,6 @@ class Poll extends ImmutablePureComponent {
     intl: PropTypes.object.isRequired,
     dispatch: PropTypes.func,
     disabled: PropTypes.bool,
-    visible: PropTypes.bool,
   };
 
   state = {
@@ -70,14 +69,13 @@ class Poll extends ImmutablePureComponent {
   };
 
   renderOption (option, optionIndex) {
-    const { poll, disabled, visible } = this.props;
-    const percent     = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100;
-    const leading     = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count'));
-    const active      = !!this.state.selected[`${optionIndex}`];
-    const showResults = poll.get('voted') || poll.get('expired');
+    const { poll, disabled } = this.props;
+    const percent            = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100;
+    const leading            = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count'));
+    const active             = !!this.state.selected[`${optionIndex}`];
+    const showResults        = poll.get('voted') || poll.get('expired');
 
     let titleEmojified = option.get('title_emojified');
-
     if (!titleEmojified) {
       const emojiMap = makeEmojiMap(poll);
       titleEmojified = emojify(escapeTextContentForBrowser(option.get('title')), emojiMap);
@@ -106,7 +104,7 @@ class Poll extends ImmutablePureComponent {
           {!showResults && <span className={classNames('poll__input', { checkbox: poll.get('multiple'), active })} />}
           {showResults && <span className='poll__number'>{Math.round(percent)}%</span>}
 
-          {visible ? <span dangerouslySetInnerHTML={{ __html: titleEmojified }} /> : <span>{String.fromCharCode(64 + optionIndex + 1)}</span>}
+          <span dangerouslySetInnerHTML={{ __html: titleEmojified }} />
         </label>
       </li>
     );
index b67354b01aba3f0d202f19340daaf9b6420cee86..28738105a6ee4b52a1347f698f5ffd398df54f4c 100644 (file)
@@ -317,7 +317,7 @@ class Status extends ImmutablePureComponent {
     }
 
     if (status.get('poll')) {
-      media = <PollContainer pollId={status.get('poll')} visible={!status.get('hidden')} />;
+      media = <PollContainer pollId={status.get('poll')} />;
     } else if (status.get('media_attachments').size > 0) {
       if (this.props.muted) {
         media = (
index 22821af0c100b234b98cfd2bc8998f7ed6d0be0b..9089eb303f475676202612512017db3157f8ed19 100644 (file)
@@ -108,7 +108,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
     }
 
     if (status.get('poll')) {
-      media = <PollContainer pollId={status.get('poll')} visible={!status.get('hidden')} />;
+      media = <PollContainer pollId={status.get('poll')} />;
     } else if (status.get('media_attachments').size > 0) {
       if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
         const video = status.getIn(['media_attachments', 0]);