Permit post has media_attachments and polls
This commit is contained in:
parent
7e8253e87b
commit
081439a7dd
4 changed files with 3 additions and 8 deletions
|
@ -281,11 +281,6 @@ export function uploadCompose(files) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getState().getIn(['compose', 'poll'])) {
|
|
||||||
dispatch(showAlert(undefined, 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()) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import PollButton from '../components/poll_button';
|
||||||
import { addPoll, removePoll } from '../../../actions/compose';
|
import { addPoll, removePoll } from '../../../actions/compose';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
unavailable: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 0),
|
unavailable: false,
|
||||||
active: state.getIn(['compose', 'poll']) !== null,
|
active: state.getIn(['compose', 'poll']) !== null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { uploadCompose } from '../../../actions/compose';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size + state.getIn(['compose', 'pending_media_attachments']) >= 4 || state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')))),
|
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size + state.getIn(['compose', 'pending_media_attachments']) >= 4 || state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')))),
|
||||||
unavailable: state.getIn(['compose', 'poll']) !== null,
|
unavailable: false,
|
||||||
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ class PostStatusService < BaseService
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > MediaAttachment::LOCAL_STATUS_ATTACHMENT_MAX || @options[:poll].present?
|
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > MediaAttachment::LOCAL_STATUS_ATTACHMENT_MAX
|
||||||
|
|
||||||
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(MediaAttachment::LOCAL_STATUS_ATTACHMENT_MAX).map(&:to_i))
|
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(MediaAttachment::LOCAL_STATUS_ATTACHMENT_MAX).map(&:to_i))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue