Skip to content

Commit

Permalink
Restore glitch-soc's support of custom poll limits
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Feb 22, 2024
1 parent 9c10aaa commit 5fd5075
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
selectComposeSuggestion,
} from 'flavours/glitch/actions/compose';
import AutosuggestInput from 'flavours/glitch/components/autosuggest_input';
import { pollLimits } from 'flavours/glitch/initial_state';

const messages = defineMessages({
option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Option {number}' },
Expand Down Expand Up @@ -83,7 +84,7 @@ const Option = ({ multipleChoice, index, title, autoFocus }) => {

<AutosuggestInput
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
maxLength={100}
maxLength={pollLimits.max_option_chars}
value={title}
lang={lang}
spellCheck
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/flavours/glitch/reducers/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
import { REDRAFT } from '../actions/statuses';
import { STORE_HYDRATE } from '../actions/store';
import { TIMELINE_DELETE } from '../actions/timelines';
import { me, defaultContentType } from '../initial_state';
import { me, defaultContentType, pollLimits } from '../initial_state';
import { recoverHashtags } from '../utils/hashtag';
import { unescapeHTML } from '../utils/html';
import { overwrite } from '../utils/js_helpers';
Expand Down Expand Up @@ -369,7 +369,7 @@ const updatePoll = (state, index, value) => state.updateIn(['poll', 'options'],

if (tmp.size === 0) {
return tmp.push('').push('');
} else if (tmp.size < 4) {
} else if (tmp.size < pollLimits.max_options) {
return tmp.push('');
}

Expand Down

0 comments on commit 5fd5075

Please sign in to comment.