about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components/poll.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-09-29 06:21:51 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-10-09 18:23:15 +0200
commitb38361a34748a49c9cd2e00adcd92a4609d27145 (patch)
tree55ff147d26d012fb71dcde535a60ff240e87299d /app/javascript/flavours/glitch/components/poll.js
parent3f0505ea15df4fd18bb5095f682a2d033ade28f7 (diff)
[Glitch] Fix various issues with logged-out Web UI
Port fixes from e623c302d5d4dfc05689eb8fb8e051e30fc38ec8 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/components/poll.js')
-rw-r--r--app/javascript/flavours/glitch/components/poll.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/poll.js b/app/javascript/flavours/glitch/components/poll.js
index 970b00705..bcd9fe341 100644
--- a/app/javascript/flavours/glitch/components/poll.js
+++ b/app/javascript/flavours/glitch/components/poll.js
@@ -34,6 +34,10 @@ const makeEmojiMap = record => record.get('emojis').reduce((obj, emoji) => {
 export default @injectIntl
 class Poll extends ImmutablePureComponent {
 
+  static contextTypes = {
+    identity: PropTypes.object,
+  };
+
   static propTypes = {
     poll: ImmutablePropTypes.map,
     intl: PropTypes.object.isRequired,
@@ -217,7 +221,7 @@ class Poll extends ImmutablePureComponent {
         </ul>
 
         <div className='poll__footer'>
-          {!showResults && <button className='button button-secondary' disabled={disabled} onClick={this.handleVote}><FormattedMessage id='poll.vote' defaultMessage='Vote' /></button>}
+          {!showResults && <button className='button button-secondary' disabled={disabled || !this.context.identity.signedIn} onClick={this.handleVote}><FormattedMessage id='poll.vote' defaultMessage='Vote' /></button>}
           {showResults && !this.props.disabled && <span><button className='poll__link' onClick={this.handleRefresh}><FormattedMessage id='poll.refresh' defaultMessage='Refresh' /></button> · </span>}
           {votesCount}
           {poll.get('expires_at') && <span> · {timeRemaining}</span>}