[Glitch] Change validation to permit polls and media being combined
Port 1bbe3872f25f4f0f7de60a35bd805608c6484c24 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
adfc894a1f
commit
dce5466365
@ -376,11 +376,6 @@ export function uploadCompose(files) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getState().getIn(['compose', 'poll'])) {
|
|
||||||
dispatch(showAlert({ message: messages.uploadErrorPoll }));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch(uploadComposeRequest());
|
dispatch(uploadComposeRequest());
|
||||||
|
|
||||||
for (const [i, file] of Array.from(files).entries()) {
|
for (const [i, file] of Array.from(files).entries()) {
|
||||||
|
|||||||
@ -4,12 +4,10 @@ import { addPoll, removePoll } from '../../../actions/compose';
|
|||||||
import PollButton from '../components/poll_button';
|
import PollButton from '../components/poll_button';
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const readyAttachmentsSize = state.compose.get('media_attachments').size ?? 0;
|
|
||||||
const hasAttachments = readyAttachmentsSize > 0 || !!state.compose.get('is_uploading');
|
|
||||||
const hasQuote = !!state.compose.get('quoted_status_id');
|
const hasQuote = !!state.compose.get('quoted_status_id');
|
||||||
|
|
||||||
return ({
|
return ({
|
||||||
disabled: hasAttachments || hasQuote,
|
disabled: hasQuote,
|
||||||
active: state.getIn(['compose', 'poll']) !== null,
|
active: state.getIn(['compose', 'poll']) !== null,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import { openModal } from '../../../actions/modal';
|
|||||||
import UploadButton from '../components/upload_button';
|
import UploadButton from '../components/upload_button';
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const isPoll = state.getIn(['compose', 'poll']) !== null;
|
|
||||||
const isUploading = state.getIn(['compose', 'is_uploading']);
|
const isUploading = state.getIn(['compose', 'is_uploading']);
|
||||||
const readyAttachmentsSize = state.getIn(['compose', 'media_attachments']).size ?? 0;
|
const readyAttachmentsSize = state.getIn(['compose', 'media_attachments']).size ?? 0;
|
||||||
const pendingAttachmentsSize = state.getIn(['compose', 'pending_media_attachments']).size ?? 0;
|
const pendingAttachmentsSize = state.getIn(['compose', 'pending_media_attachments']).size ?? 0;
|
||||||
@ -15,7 +14,7 @@ const mapStateToProps = state => {
|
|||||||
const hasQuote = !!state.compose.get('quoted_status_id');
|
const hasQuote = !!state.compose.get('quoted_status_id');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
disabled: isPoll || isUploading || isOverLimit || hasVideoOrAudio || hasQuote,
|
disabled: isUploading || isOverLimit || hasVideoOrAudio || hasQuote,
|
||||||
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user