Commit e5a05a92 authored by 2458773093's avatar 2458773093

edit integration

parent 2fdeccd1
...@@ -53,7 +53,7 @@ export function normalizeStatus(status, normalOldStatus) { ...@@ -53,7 +53,7 @@ export function normalizeStatus(status, normalOldStatus) {
// Only calculate these values when status first encountered // Only calculate these values when status first encountered
// Otherwise keep the ones already in the reducer // Otherwise keep the ones already in the reducer
if (normalOldStatus) { if (normalOldStatus && normalOldStatus.get('content') === normalStatus.content && normalOldStatus.get('spoiler_text') === normalStatus.spoiler_text) {
normalStatus.search_index = normalOldStatus.get('search_index'); normalStatus.search_index = normalOldStatus.get('search_index');
normalStatus.contentHtml = normalOldStatus.get('contentHtml'); normalStatus.contentHtml = normalOldStatus.get('contentHtml');
normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml'); normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
......
...@@ -10,6 +10,7 @@ const messages = defineMessages({ ...@@ -10,6 +10,7 @@ const messages = defineMessages({
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
composeId: state.getIn(['compose', 'id']),
composeText: state.getIn(['compose', 'text']), composeText: state.getIn(['compose', 'text']),
}); });
...@@ -30,6 +31,7 @@ class ModalRoot extends React.PureComponent { ...@@ -30,6 +31,7 @@ class ModalRoot extends React.PureComponent {
onOpenModal: PropTypes.func.isRequired, onOpenModal: PropTypes.func.isRequired,
onCancelReplyCompose: PropTypes.func.isRequired, onCancelReplyCompose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
composeId: PropTypes.string,
composeText: PropTypes.string, composeText: PropTypes.string,
type: PropTypes.string, type: PropTypes.string,
}; };
...@@ -48,9 +50,9 @@ class ModalRoot extends React.PureComponent { ...@@ -48,9 +50,9 @@ class ModalRoot extends React.PureComponent {
} }
handleOnClose = () => { handleOnClose = () => {
const { onOpenModal, composeText, onClose, intl, type, onCancelReplyCompose } = this.props; const { onOpenModal, composeText, composeId, onClose, intl, type, onCancelReplyCompose } = this.props;
if (composeText && type == 'COMPOSE') { if (!composeId && composeText && type == 'COMPOSE') {
onOpenModal('CONFIRM', { onOpenModal('CONFIRM', {
message: <FormattedMessage id='confirmations.delete.message' defaultMessage='Are you sure you want to delete this status?' />, message: <FormattedMessage id='confirmations.delete.message' defaultMessage='Are you sure you want to delete this status?' />,
confirm: intl.formatMessage(messages.confirm), confirm: intl.formatMessage(messages.confirm),
......
...@@ -46,6 +46,7 @@ class ComposeForm extends ImmutablePureComponent { ...@@ -46,6 +46,7 @@ class ComposeForm extends ImmutablePureComponent {
static propTypes = { static propTypes = {
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
edit: PropTypes.bool.isRequired,
text: PropTypes.string.isRequired, text: PropTypes.string.isRequired,
suggestions: ImmutablePropTypes.list, suggestions: ImmutablePropTypes.list,
spoiler: PropTypes.bool, spoiler: PropTypes.bool,
...@@ -200,7 +201,7 @@ class ComposeForm extends ImmutablePureComponent { ...@@ -200,7 +201,7 @@ class ComposeForm extends ImmutablePureComponent {
} }
render () { render () {
const { intl, onPaste, showSearch, anyMedia, shouldCondense, autoFocus, isModalOpen, quoteOfId } = this.props; const { intl, onPaste, showSearch, anyMedia, shouldCondense, autoFocus, isModalOpen, quoteOfId, edit } = this.props;
const condensed = shouldCondense && !this.props.text && !this.state.composeFocused; const condensed = shouldCondense && !this.props.text && !this.state.composeFocused;
const disabled = this.props.isSubmitting; const disabled = this.props.isSubmitting;
const text = [this.props.spoilerText, countableText(this.props.text)].join(''); const text = [this.props.spoilerText, countableText(this.props.text)].join('');
...@@ -267,7 +268,7 @@ class ComposeForm extends ImmutablePureComponent { ...@@ -267,7 +268,7 @@ class ComposeForm extends ImmutablePureComponent {
!condensed && !condensed &&
<div className='compose-form__modifiers'> <div className='compose-form__modifiers'>
<UploadFormContainer /> <UploadFormContainer />
<PollFormContainer /> {!edit && <PollFormContainer />}
</div> </div>
} }
</AutosuggestTextarea> </AutosuggestTextarea>
...@@ -279,7 +280,7 @@ class ComposeForm extends ImmutablePureComponent { ...@@ -279,7 +280,7 @@ class ComposeForm extends ImmutablePureComponent {
<div className='compose-form__buttons-wrapper'> <div className='compose-form__buttons-wrapper'>
<div className='compose-form__buttons'> <div className='compose-form__buttons'>
<UploadButtonContainer /> <UploadButtonContainer />
<PollButtonContainer /> {!edit && <PollButtonContainer />}
<PrivacyDropdownContainer /> <PrivacyDropdownContainer />
<SpoilerButtonContainer /> <SpoilerButtonContainer />
</div> </div>
......
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
} from '../../../actions/compose'; } from '../../../actions/compose';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
edit: state.getIn(['compose', 'id']) !== null,
text: state.getIn(['compose', 'text']), text: state.getIn(['compose', 'text']),
suggestions: state.getIn(['compose', 'suggestions']), suggestions: state.getIn(['compose', 'suggestions']),
spoiler: state.getIn(['compose', 'spoiler']), spoiler: state.getIn(['compose', 'spoiler']),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment