2
0
Fork 0

Allow posting media alongside polls

This commit is contained in:
Essem 2023-11-28 23:33:17 -06:00
commit e797b43a32
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
5 changed files with 4 additions and 13 deletions

View file

@ -88,7 +88,6 @@ export const COMPOSE_SET_STATUS = 'COMPOSE_SET_STATUS';
const messages = defineMessages({
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
});
export const ensureComposeIsVisible = (getState, routerHistory) => {
@ -318,11 +317,6 @@ export function uploadCompose(files, alt = '') {
return;
}
if (getState().getIn(['compose', 'poll'])) {
dispatch(showAlert(undefined, messages.uploadErrorPoll));
return;
}
dispatch(uploadComposeRequest());
for (const [i, f] of Array.from(files).entries()) {

View file

@ -134,7 +134,6 @@ class ComposerOptions extends ImmutablePureComponent {
advancedOptions: ImmutablePropTypes.map,
disabled: PropTypes.bool,
allowMedia: PropTypes.bool,
allowPoll: PropTypes.bool,
hasPoll: PropTypes.bool,
intl: PropTypes.object.isRequired,
onChangeAdvancedOption: PropTypes.func,
@ -206,7 +205,6 @@ class ComposerOptions extends ImmutablePureComponent {
contentType,
disabled,
allowMedia,
allowPoll,
hasPoll,
onChangeAdvancedOption,
onChangeContentType,
@ -276,7 +274,7 @@ class ComposerOptions extends ImmutablePureComponent {
{!!pollLimits && (
<IconButton
active={hasPoll}
disabled={disabled || !allowPoll}
disabled={disabled}
icon='tasks'
inverted
onClick={onTogglePoll}

View file

@ -18,8 +18,7 @@ function mapStateToProps (state) {
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']).toArray().join(','),
resetFileKey: state.getIn(['compose', 'resetFileKey']),
hasPoll: !!poll,
allowMedia: !poll && (media ? media.size + pending_media < 4 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 4),
allowPoll: !(media && !!media.size),
allowMedia: media ? media.size + pending_media < 4 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 4,
showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),
contentType: state.getIn(['compose', 'content_type']),
};