add uploads to polls
This commit is contained in:
parent
30a5a0baa9
commit
a3201605b4
5 changed files with 11 additions and 12 deletions
|
@ -226,11 +226,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, f] of Array.from(files).entries()) {
|
for (const [i, f] of Array.from(files).entries()) {
|
||||||
|
|
|
@ -265,6 +265,7 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let media = null;
|
let media = null;
|
||||||
|
let poll = null;
|
||||||
let statusAvatar, prepend, rebloggedByText, reblogContent;
|
let statusAvatar, prepend, rebloggedByText, reblogContent;
|
||||||
|
|
||||||
const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props;
|
const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props;
|
||||||
|
@ -332,8 +333,9 @@ class Status extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.get('poll')) {
|
if (status.get('poll')) {
|
||||||
media = <PollContainer pollId={status.get('poll')} />;
|
poll = <PollContainer pollId={status.get('poll')} />;
|
||||||
} else if (status.get('media_attachments').size > 0) {
|
}
|
||||||
|
if (status.get('media_attachments').size > 0) {
|
||||||
if (this.props.muted) {
|
if (this.props.muted) {
|
||||||
media = (
|
media = (
|
||||||
<AttachmentList
|
<AttachmentList
|
||||||
|
@ -473,6 +475,7 @@ class Status extends ImmutablePureComponent {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{media}
|
{media}
|
||||||
|
{poll}
|
||||||
|
|
||||||
{showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && (
|
{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}>
|
<button className='status__content__read-more-button' onClick={this.handleClick}>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { uploadCompose } from '../../../actions/compose';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
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')),
|
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']),
|
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
let media = '';
|
let media = '';
|
||||||
|
let poll = '';
|
||||||
let statusTypeIcon = '';
|
let statusTypeIcon = '';
|
||||||
|
|
||||||
if (this.props.measureHeight) {
|
if (this.props.measureHeight) {
|
||||||
|
@ -98,8 +99,9 @@ export default class DetailedStatus extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.get('poll')) {
|
if (status.get('poll')) {
|
||||||
media = <PollContainer pollId={status.get('poll')} />;
|
poll = <PollContainer pollId={status.get('poll')} />;
|
||||||
} else if (status.get('media_attachments').size > 0) {
|
}
|
||||||
|
if (status.get('media_attachments').size > 0) {
|
||||||
if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
|
if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
|
||||||
const video = status.getIn(['media_attachments', 0]);
|
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} />
|
<StatusContent status={status} expanded={!status.get('hidden')} onExpandedToggle={this.handleExpandedToggle} />
|
||||||
|
|
||||||
{media}
|
{media}
|
||||||
|
{poll}
|
||||||
|
|
||||||
<div className='detailed-status__meta'>
|
<div className='detailed-status__meta'>
|
||||||
<StatusInteractionBar status={status} />
|
<StatusInteractionBar status={status} />
|
||||||
|
|
|
@ -211,8 +211,7 @@ export default function compose(state = initialState, action) {
|
||||||
.set('is_composing', false);
|
.set('is_composing', false);
|
||||||
case COMPOSE_SENSITIVITY_CHANGE:
|
case COMPOSE_SENSITIVITY_CHANGE:
|
||||||
return state.withMutations(map => {
|
return state.withMutations(map => {
|
||||||
map.set('sensitive', !state.get('sensitive'));
|
map.set('sensitive', !state.get('sensitive'));
|
||||||
|
|
||||||
map.set('idempotencyKey', uuid());
|
map.set('idempotencyKey', uuid());
|
||||||
});
|
});
|
||||||
case COMPOSE_SPOILERNESS_CHANGE:
|
case COMPOSE_SPOILERNESS_CHANGE:
|
||||||
|
|
Loading…
Reference in a new issue