[Glitch] Fix Edit as well as “Delete & Redraft” on a poll not inserting empty option

Port a48567784c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Claire
2025-08-25 14:25:35 +02:00
parent 789df6b196
commit 6e406e119f
3 changed files with 33 additions and 13 deletions

View File

@@ -623,8 +623,13 @@ export default function compose(state = initialState, action) {
}
if (action.status.get('poll')) {
let options = ImmutableList(action.status.get('poll').options.map(x => x.title));
if (options.size < action.maxOptions) {
options = options.push('');
}
map.set('poll', ImmutableMap({
options: action.status.getIn(['poll', 'options']).map(x => x.get('title')),
options: options,
multiple: action.status.getIn(['poll', 'multiple']),
expires_in: expiresInFromExpiresAt(action.status.getIn(['poll', 'expires_at'])),
}));
@@ -653,8 +658,13 @@ export default function compose(state = initialState, action) {
}
if (action.status.get('poll')) {
let options = ImmutableList(action.status.get('poll').options.map(x => x.title));
if (options.size < action.maxOptions) {
options = options.push('');
}
map.set('poll', ImmutableMap({
options: action.status.getIn(['poll', 'options']).map(x => x.get('title')),
options: options,
multiple: action.status.getIn(['poll', 'multiple']),
expires_in: expiresInFromExpiresAt(action.status.getIn(['poll', 'expires_at'])),
}));