Merge branch 'master' of git.skehsucks.xyz:ida/mastodonisnotalive
This commit is contained in:
commit
0f3909531d
2 changed files with 4 additions and 5 deletions
app
|
@ -77,7 +77,7 @@ class Option extends React.PureComponent {
|
|||
|
||||
<AutosuggestInput
|
||||
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
|
||||
maxLength={25}
|
||||
maxLength={150}
|
||||
value={title}
|
||||
onChange={this.handleOptionTitleChange}
|
||||
suggestions={this.props.suggestions}
|
||||
|
@ -142,7 +142,7 @@ class PollForm extends ImmutablePureComponent {
|
|||
</ul>
|
||||
|
||||
<div className='poll__footer'>
|
||||
{options.size < 4 && (
|
||||
{options.size < 25 && (
|
||||
<button className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
|
||||
)}
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PollValidator < ActiveModel::Validator
|
||||
MAX_OPTIONS = 4
|
||||
MAX_OPTION_CHARS = 25
|
||||
MAX_OPTIONS = 25
|
||||
MAX_OPTION_CHARS = 150
|
||||
MAX_EXPIRATION = 1.month.freeze
|
||||
MIN_EXPIRATION = 5.minutes.freeze
|
||||
|
||||
def validate(poll)
|
||||
current_time = Time.now.utc
|
||||
|
||||
poll.errors.add(:options, I18n.t('polls.errors.too_few_options')) unless poll.options.size > 1
|
||||
poll.errors.add(:options, I18n.t('polls.errors.too_many_options', max: MAX_OPTIONS)) if poll.options.size > MAX_OPTIONS
|
||||
poll.errors.add(:options, I18n.t('polls.errors.over_character_limit', max: MAX_OPTION_CHARS)) if poll.options.any? { |option| option.mb_chars.grapheme_length > MAX_OPTION_CHARS }
|
||||
poll.errors.add(:options, I18n.t('polls.errors.duplicate_options')) unless poll.options.uniq.size == poll.options.size
|
||||
|
|
Loading…
Add table
Reference in a new issue