add uploads to polls

tl-language-filters
Mary Kate 4 years ago
parent 30a5a0baa9
commit a3201605b4

@ -226,11 +226,6 @@ export function uploadCompose(files) {
return;
}
if (getState().getIn(['compose', 'poll'])) {
dispatch(showAlert(undefined, messages.uploadErrorPoll));
return;
}
dispatch(uploadComposeRequest());
for (const [i, f] of Array.from(files).entries()) {

@ -265,6 +265,7 @@ class Status extends ImmutablePureComponent {
render() {
let media = null;
let poll = null;
let statusAvatar, prepend, rebloggedByText, reblogContent;
const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props;
@ -332,8 +333,9 @@ class Status extends ImmutablePureComponent {
}
if (status.get('poll')) {
media = <PollContainer pollId={status.get('poll')} />;
} else if (status.get('media_attachments').size > 0) {
poll = <PollContainer pollId={status.get('poll')} />;
}
if (status.get('media_attachments').size > 0) {
if (this.props.muted) {
media = (
<AttachmentList
@ -473,6 +475,7 @@ class Status extends ImmutablePureComponent {
/>
{media}
{poll}
{showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && (
<button className='status__content__read-more-button' onClick={this.handleClick}>

@ -4,7 +4,6 @@ import { uploadCompose } from '../../../actions/compose';
const mapStateToProps = state => ({
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
unavailable: state.getIn(['compose', 'poll']) !== null,
resetFileKey: state.getIn(['compose', 'resetFileKey']),
});

@ -91,6 +91,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
}
let media = '';
let poll = '';
let statusTypeIcon = '';
if (this.props.measureHeight) {
@ -98,8 +99,9 @@ export default class DetailedStatus extends ImmutablePureComponent {
}
if (status.get('poll')) {
media = <PollContainer pollId={status.get('poll')} />;
} else if (status.get('media_attachments').size > 0) {
poll = <PollContainer pollId={status.get('poll')} />;
}
if (status.get('media_attachments').size > 0) {
if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
const video = status.getIn(['media_attachments', 0]);
@ -172,6 +174,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
<StatusContent status={status} expanded={!status.get('hidden')} onExpandedToggle={this.handleExpandedToggle} />
{media}
{poll}
<div className='detailed-status__meta'>
<StatusInteractionBar status={status} />

@ -211,8 +211,7 @@ export default function compose(state = initialState, action) {
.set('is_composing', false);
case COMPOSE_SENSITIVITY_CHANGE:
return state.withMutations(map => {
map.set('sensitive', !state.get('sensitive'));
map.set('sensitive', !state.get('sensitive'));
map.set('idempotencyKey', uuid());
});
case COMPOSE_SPOILERNESS_CHANGE:

Loading…
Cancel
Save