Restore glitch-soc's support of custom poll limits
parent
9c10aaa4d5
commit
5fd50756b4
|
@ -15,6 +15,7 @@ import {
|
||||||
selectComposeSuggestion,
|
selectComposeSuggestion,
|
||||||
} from 'flavours/glitch/actions/compose';
|
} from 'flavours/glitch/actions/compose';
|
||||||
import AutosuggestInput from 'flavours/glitch/components/autosuggest_input';
|
import AutosuggestInput from 'flavours/glitch/components/autosuggest_input';
|
||||||
|
import { pollLimits } from 'flavours/glitch/initial_state';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Option {number}' },
|
option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Option {number}' },
|
||||||
|
@ -83,7 +84,7 @@ const Option = ({ multipleChoice, index, title, autoFocus }) => {
|
||||||
|
|
||||||
<AutosuggestInput
|
<AutosuggestInput
|
||||||
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
|
placeholder={intl.formatMessage(messages.option_placeholder, { number: index + 1 })}
|
||||||
maxLength={100}
|
maxLength={pollLimits.max_option_chars}
|
||||||
value={title}
|
value={title}
|
||||||
lang={lang}
|
lang={lang}
|
||||||
spellCheck
|
spellCheck
|
||||||
|
|
|
@ -55,7 +55,7 @@ import {
|
||||||
import { REDRAFT } from '../actions/statuses';
|
import { REDRAFT } from '../actions/statuses';
|
||||||
import { STORE_HYDRATE } from '../actions/store';
|
import { STORE_HYDRATE } from '../actions/store';
|
||||||
import { TIMELINE_DELETE } from '../actions/timelines';
|
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 { recoverHashtags } from '../utils/hashtag';
|
||||||
import { unescapeHTML } from '../utils/html';
|
import { unescapeHTML } from '../utils/html';
|
||||||
import { overwrite } from '../utils/js_helpers';
|
import { overwrite } from '../utils/js_helpers';
|
||||||
|
@ -369,7 +369,7 @@ const updatePoll = (state, index, value) => state.updateIn(['poll', 'options'],
|
||||||
|
|
||||||
if (tmp.size === 0) {
|
if (tmp.size === 0) {
|
||||||
return tmp.push('').push('');
|
return tmp.push('').push('');
|
||||||
} else if (tmp.size < 4) {
|
} else if (tmp.size < pollLimits.max_options) {
|
||||||
return tmp.push('');
|
return tmp.push('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue