about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/composer/options
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-06 13:42:48 +0100
committerThibG <thib@sitedethib.com>2019-03-06 23:56:53 +0100
commit235be596bc6a6ed6a042975ac7f698695d6cda19 (patch)
tree0e52fe57987e7d64fdcd239c73d91a7193c5f1ed /app/javascript/flavours/glitch/features/composer/options
parent3b1390dc789b52cf570a179daf50d4cb8afbfbcd (diff)
Use server-provided poll limits instead of hardcoded ones
Also does not enable polls if no limits are provided by the server
Diffstat (limited to 'app/javascript/flavours/glitch/features/composer/options')
-rw-r--r--app/javascript/flavours/glitch/features/composer/options/index.js29
1 files changed, 16 insertions, 13 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/options/index.js b/app/javascript/flavours/glitch/features/composer/options/index.js
index 80ac1b63a..7c7f01dc2 100644
--- a/app/javascript/flavours/glitch/features/composer/options/index.js
+++ b/app/javascript/flavours/glitch/features/composer/options/index.js
@@ -19,6 +19,7 @@ import {
   assignHandlers,
   hiddenComponent,
 } from 'flavours/glitch/util/react_helpers';
+import { pollLimits } from 'flavours/glitch/util/initial_state';
 
 //  Messages.
 const messages = defineMessages({
@@ -248,19 +249,21 @@ export default class ComposerOptions extends React.PureComponent {
           onModalOpen={onModalOpen}
           title={intl.formatMessage(messages.attach)}
         />
-        <IconButton
-          active={hasPoll}
-          disabled={disabled || !allowPoll}
-          icon='tasks'
-          inverted
-          onClick={onTogglePoll}
-          size={18}
-          style={{
-            height: null,
-            lineHeight: null,
-          }}
-          title={intl.formatMessage(hasPoll ? messages.remove_poll : messages.add_poll)}
-        />
+        {!!pollLimits && (
+          <IconButton
+            active={hasPoll}
+            disabled={disabled || !allowPoll}
+            icon='tasks'
+            inverted
+            onClick={onTogglePoll}
+            size={18}
+            style={{
+              height: null,
+              lineHeight: null,
+            }}
+            title={intl.formatMessage(hasPoll ? messages.remove_poll : messages.add_poll)}
+          />
+        )}
         <Motion
           defaultStyle={{ scale: 0.87 }}
           style={{