Skip to content

Commit 7c8e3cf

Browse files
ClearlyClaireGargron
authored andcommitted
Disable file upload when there is a poll (mastodon#10195)
1 parent e3d753b commit 7c8e3cf

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/javascript/mastodon/actions/compose.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const COMPOSE_POLL_SETTINGS_CHANGE = 'COMPOSE_POLL_SETTINGS_CHANGE';
6060

6161
const messages = defineMessages({
6262
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
63+
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
6364
});
6465

6566
export function changeCompose(text) {
@@ -207,6 +208,12 @@ export function uploadCompose(files) {
207208
dispatch(showAlert(undefined, messages.uploadErrorLimit));
208209
return;
209210
}
211+
212+
if (getState().getIn(['compose', 'poll'])) {
213+
dispatch(showAlert(undefined, messages.uploadErrorPoll));
214+
return;
215+
}
216+
210217
dispatch(uploadComposeRequest());
211218

212219
for (const [i, f] of Array.from(files).entries()) {

0 commit comments

Comments
 (0)