|
@ -31,6 +31,7 @@ import { |
|
|
openModal, |
|
|
openModal, |
|
|
} from 'flavours/glitch/actions/modal'; |
|
|
} from 'flavours/glitch/actions/modal'; |
|
|
import { changeLocalSetting } from 'flavours/glitch/actions/local_settings'; |
|
|
import { changeLocalSetting } from 'flavours/glitch/actions/local_settings'; |
|
|
|
|
|
import { addPoll, removePoll } from 'flavours/glitch/actions/compose'; |
|
|
|
|
|
|
|
|
// Components.
|
|
|
// Components.
|
|
|
import ComposerOptions from './options'; |
|
|
import ComposerOptions from './options'; |
|
@ -39,6 +40,7 @@ import ComposerReply from './reply'; |
|
|
import ComposerSpoiler from './spoiler'; |
|
|
import ComposerSpoiler from './spoiler'; |
|
|
import ComposerTextarea from './textarea'; |
|
|
import ComposerTextarea from './textarea'; |
|
|
import ComposerUploadForm from './upload_form'; |
|
|
import ComposerUploadForm from './upload_form'; |
|
|
|
|
|
import ComposerPollForm from './poll_form'; |
|
|
import ComposerWarning from './warning'; |
|
|
import ComposerWarning from './warning'; |
|
|
import ComposerHashtagWarning from './hashtag_warning'; |
|
|
import ComposerHashtagWarning from './hashtag_warning'; |
|
|
import ComposerDirectWarning from './direct_warning'; |
|
|
import ComposerDirectWarning from './direct_warning'; |
|
@ -102,6 +104,7 @@ function mapStateToProps (state) { |
|
|
suggestions: state.getIn(['compose', 'suggestions']), |
|
|
suggestions: state.getIn(['compose', 'suggestions']), |
|
|
text: state.getIn(['compose', 'text']), |
|
|
text: state.getIn(['compose', 'text']), |
|
|
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0, |
|
|
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0, |
|
|
|
|
|
poll: state.getIn(['compose', 'poll']), |
|
|
spoilersAlwaysOn: spoilersAlwaysOn, |
|
|
spoilersAlwaysOn: spoilersAlwaysOn, |
|
|
mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']), |
|
|
mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']), |
|
|
preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']), |
|
|
preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']), |
|
@ -134,6 +137,15 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ |
|
|
onChangeVisibility(value) { |
|
|
onChangeVisibility(value) { |
|
|
dispatch(changeComposeVisibility(value)); |
|
|
dispatch(changeComposeVisibility(value)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
onTogglePoll() { |
|
|
|
|
|
dispatch((_, getState) => { |
|
|
|
|
|
if (getState().getIn(['compose', 'poll'])) { |
|
|
|
|
|
dispatch(removePoll()); |
|
|
|
|
|
} else { |
|
|
|
|
|
dispatch(addPoll()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
onClearSuggestions() { |
|
|
onClearSuggestions() { |
|
|
dispatch(clearComposeSuggestions()); |
|
|
dispatch(clearComposeSuggestions()); |
|
|
}, |
|
|
}, |
|
@ -394,6 +406,7 @@ class Composer extends React.Component { |
|
|
isUploading, |
|
|
isUploading, |
|
|
layout, |
|
|
layout, |
|
|
media, |
|
|
media, |
|
|
|
|
|
poll, |
|
|
onCancelReply, |
|
|
onCancelReply, |
|
|
onChangeAdvancedOption, |
|
|
onChangeAdvancedOption, |
|
|
onChangeDescription, |
|
|
onChangeDescription, |
|
@ -401,6 +414,7 @@ class Composer extends React.Component { |
|
|
onChangeSpoilerness, |
|
|
onChangeSpoilerness, |
|
|
onChangeText, |
|
|
onChangeText, |
|
|
onChangeVisibility, |
|
|
onChangeVisibility, |
|
|
|
|
|
onTogglePoll, |
|
|
onClearSuggestions, |
|
|
onClearSuggestions, |
|
|
onCloseModal, |
|
|
onCloseModal, |
|
|
onFetchSuggestions, |
|
|
onFetchSuggestions, |
|
@ -463,30 +477,38 @@ class Composer extends React.Component { |
|
|
suggestions={suggestions} |
|
|
suggestions={suggestions} |
|
|
value={text} |
|
|
value={text} |
|
|
/> |
|
|
/> |
|
|
{isUploading || media && media.size ? ( |
|
|
|
|
|
<ComposerUploadForm |
|
|
|
|
|
intl={intl} |
|
|
|
|
|
media={media} |
|
|
|
|
|
onChangeDescription={onChangeDescription} |
|
|
|
|
|
onOpenFocalPointModal={onOpenFocalPointModal} |
|
|
|
|
|
onRemove={onUndoUpload} |
|
|
|
|
|
progress={progress} |
|
|
|
|
|
uploading={isUploading} |
|
|
|
|
|
handleRef={handleRefUploadForm} |
|
|
|
|
|
/> |
|
|
|
|
|
) : null} |
|
|
|
|
|
|
|
|
<div className='compose-form__modifiers'> |
|
|
|
|
|
{isUploading || media && media.size ? ( |
|
|
|
|
|
<ComposerUploadForm |
|
|
|
|
|
intl={intl} |
|
|
|
|
|
media={media} |
|
|
|
|
|
onChangeDescription={onChangeDescription} |
|
|
|
|
|
onOpenFocalPointModal={onOpenFocalPointModal} |
|
|
|
|
|
onRemove={onUndoUpload} |
|
|
|
|
|
progress={progress} |
|
|
|
|
|
uploading={isUploading} |
|
|
|
|
|
handleRef={handleRefUploadForm} |
|
|
|
|
|
/> |
|
|
|
|
|
) : null} |
|
|
|
|
|
{!!poll && ( |
|
|
|
|
|
<ComposerPollForm /> |
|
|
|
|
|
)} |
|
|
|
|
|
</div> |
|
|
<ComposerOptions |
|
|
<ComposerOptions |
|
|
acceptContentTypes={acceptContentTypes} |
|
|
acceptContentTypes={acceptContentTypes} |
|
|
advancedOptions={advancedOptions} |
|
|
advancedOptions={advancedOptions} |
|
|
disabled={isSubmitting} |
|
|
disabled={isSubmitting} |
|
|
full={media ? media.size >= 4 || media.some( |
|
|
|
|
|
item => item.get('type') === 'video' |
|
|
|
|
|
) : false} |
|
|
|
|
|
|
|
|
allowMedia={!poll && (media ? media.size < 4 && !media.some( |
|
|
|
|
|
item => item.get('type') === 'video' |
|
|
|
|
|
) : true)} |
|
|
hasMedia={media && !!media.size} |
|
|
hasMedia={media && !!media.size} |
|
|
|
|
|
allowPoll={!(media && !!media.size)} |
|
|
|
|
|
hasPoll={!!poll} |
|
|
intl={intl} |
|
|
intl={intl} |
|
|
onChangeAdvancedOption={onChangeAdvancedOption} |
|
|
onChangeAdvancedOption={onChangeAdvancedOption} |
|
|
onChangeSensitivity={onChangeSensitivity} |
|
|
onChangeSensitivity={onChangeSensitivity} |
|
|
onChangeVisibility={onChangeVisibility} |
|
|
onChangeVisibility={onChangeVisibility} |
|
|
|
|
|
onTogglePoll={onTogglePoll} |
|
|
onDoodleOpen={onOpenDoodleModal} |
|
|
onDoodleOpen={onOpenDoodleModal} |
|
|
onModalClose={onCloseModal} |
|
|
onModalClose={onCloseModal} |
|
|
onModalOpen={onOpenActionsModal} |
|
|
onModalOpen={onOpenActionsModal} |
|
|