Skip to content

Instantly share code, notes, and snippets.

@ashphy
Last active April 18, 2020 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashphy/28a72fcb266379711ebb56fc85b1e8be to your computer and use it in GitHub Desktop.
Save ashphy/28a72fcb266379711ebb56fc85b1e8be to your computer and use it in GitHub Desktop.
Custom patch for the maximum number of options of mastodon poll. (v3.1.3)
diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js
index 01df31d3a..afd0ca2d0 100644
--- a/app/javascript/mastodon/features/compose/components/poll_form.js
+++ b/app/javascript/mastodon/features/compose/components/poll_form.js
@@ -153,7 +153,7 @@ class PollForm extends ImmutablePureComponent {
</ul>
<div className='poll__footer'>
- <button disabled={options.size >= 4} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></
+ <button disabled={options.size >= 100} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} />
<select value={expiresIn} onChange={this.handleSelectDuration}>
<option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option>
diff --git a/app/validators/poll_validator.rb b/app/validators/poll_validator.rb
index 9d7321cad..5266939a1 100644
--- a/app/validators/poll_validator.rb
+++ b/app/validators/poll_validator.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class PollValidator < ActiveModel::Validator
- MAX_OPTIONS = 4
+ MAX_OPTIONS = 100
MAX_OPTION_CHARS = 25
MAX_EXPIRATION = 1.month.freeze
MIN_EXPIRATION = 5.minutes.freeze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment