Fix quote spoiler being open by default
This commit is contained in:
parent
0a01d76da3
commit
dcc44c6d53
|
@ -66,7 +66,6 @@ export function normalizeStatus(status, normalOldStatus) {
|
|||
normalStatus.spoiler_text = normalOldStatus.get('spoiler_text');
|
||||
normalStatus.hidden = normalOldStatus.get('hidden');
|
||||
normalStatus.visibility = normalOldStatus.get('visibility');
|
||||
normalStatus.quote_hidden = normalOldStatus.get('quote_hidden');
|
||||
} else {
|
||||
// If the status has a CW but no contents, treat the CW as if it were the
|
||||
// status' contents, to avoid having a CW toggle with seemingly no effect.
|
||||
|
|
|
@ -35,9 +35,6 @@ export const STATUS_COLLAPSE = 'STATUS_COLLAPSE';
|
|||
|
||||
export const REDRAFT = 'REDRAFT';
|
||||
|
||||
export const QUOTE_REVEAL = 'QUOTE_REVEAL';
|
||||
export const QUOTE_HIDE = 'QUOTE_HIDE';
|
||||
|
||||
export function fetchStatusRequest(id, skipLoading) {
|
||||
return {
|
||||
type: STATUS_FETCH_REQUEST,
|
||||
|
@ -332,25 +329,3 @@ export function toggleStatusCollapse(id, isCollapsed) {
|
|||
isCollapsed,
|
||||
};
|
||||
}
|
||||
|
||||
export function hideQuote(ids) {
|
||||
if (!Array.isArray(ids)) {
|
||||
ids = [ids];
|
||||
}
|
||||
|
||||
return {
|
||||
type: QUOTE_HIDE,
|
||||
ids,
|
||||
};
|
||||
};
|
||||
|
||||
export function revealQuote(ids) {
|
||||
if (!Array.isArray(ids)) {
|
||||
ids = [ids];
|
||||
}
|
||||
|
||||
return {
|
||||
type: QUOTE_REVEAL,
|
||||
ids,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -132,7 +132,6 @@ class Status extends ImmutablePureComponent {
|
|||
onHeightChange: PropTypes.func,
|
||||
onToggleHidden: PropTypes.func,
|
||||
onToggleCollapsed: PropTypes.func,
|
||||
onQuoteToggleHidden: PropTypes.func,
|
||||
onReference: PropTypes.func,
|
||||
onAddToList: PropTypes.func.isRequired,
|
||||
muted: PropTypes.bool,
|
||||
|
@ -263,8 +262,8 @@ class Status extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
handleExpandedQuoteToggle = () => {
|
||||
this.props.onQuoteToggleHidden(this._properStatus());
|
||||
};
|
||||
this.props.onToggleHidden(this._properQuoteStatus());
|
||||
}
|
||||
|
||||
renderLoadingMediaGallery () {
|
||||
return <div className='media-gallery' style={{ height: '110px' }} />;
|
||||
|
@ -696,7 +695,7 @@ class Status extends ImmutablePureComponent {
|
|||
<DisplayName account={quote_status.get('account')} />
|
||||
</a>
|
||||
</div>
|
||||
<StatusContent status={quote_status} onClick={this.handleQuoteClick} expanded={!status.get('quote_hidden')} onExpandedToggle={this.handleExpandedQuoteToggle} quote />
|
||||
<StatusContent status={quote_status} onClick={this.handleQuoteClick} expanded={!quote_status.get('hidden')} onExpandedToggle={this.handleExpandedQuoteToggle} quote />
|
||||
{quote_media}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -29,8 +29,6 @@ import {
|
|||
hideStatus,
|
||||
revealStatus,
|
||||
toggleStatusCollapse,
|
||||
hideQuote,
|
||||
revealQuote,
|
||||
} from '../actions/statuses';
|
||||
import {
|
||||
followAccount,
|
||||
|
@ -90,7 +88,7 @@ const makeMapStateToProps = () => {
|
|||
id,
|
||||
referenced: state.getIn(['compose', 'references']).has(id),
|
||||
contextReferenced: state.getIn(['compose', 'context_references']).has(id),
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
return mapStateToProps;
|
||||
|
@ -268,14 +266,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
|||
dispatch(deployPictureInPicture(status.get('id'), status.getIn(['account', 'id']), type, mediaProps));
|
||||
},
|
||||
|
||||
onQuoteToggleHidden (status) {
|
||||
if (status.get('quote_hidden')) {
|
||||
dispatch(revealQuote(status.get('id')));
|
||||
} else {
|
||||
dispatch(hideQuote(status.get('id')));
|
||||
}
|
||||
},
|
||||
|
||||
onFollow (account) {
|
||||
if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
|
||||
if (unfollowModal) {
|
||||
|
|
|
@ -90,7 +90,6 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
available: PropTypes.bool,
|
||||
}),
|
||||
onToggleMediaVisibility: PropTypes.func,
|
||||
onQuoteToggleHidden: PropTypes.func.isRequired,
|
||||
showQuoteMedia: PropTypes.bool,
|
||||
onToggleQuoteMediaVisibility: PropTypes.func,
|
||||
emojiMap: ImmutablePropTypes.map,
|
||||
|
@ -165,7 +164,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
handleExpandedQuoteToggle = () => {
|
||||
this.props.onQuoteToggleHidden(this.props.status);
|
||||
this.props.onToggleHidden(this.props.status.get('quote'));
|
||||
}
|
||||
|
||||
handleQuoteClick = () => {
|
||||
|
@ -179,7 +178,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
|
||||
render () {
|
||||
const status = (this.props.status && this.props.status.get('reblog')) ? this.props.status.get('reblog') : this.props.status;
|
||||
const quote_muted = this.props.quote_muted
|
||||
const quote_muted = this.props.quote_muted;
|
||||
const outerStyle = { boxSizing: 'border-box' };
|
||||
const { intl, compact, pictureInPicture, referenced, contextReferenced } = this.props;
|
||||
|
||||
|
@ -278,7 +277,7 @@ class DetailedStatus extends ImmutablePureComponent {
|
|||
<DisplayName account={quote_status.get('account')} localDomain={this.props.domain} />
|
||||
</a>
|
||||
|
||||
<StatusContent status={quote_status} onClick={this.handleQuoteClick} expanded={!status.get('quote_hidden')} onExpandedToggle={this.handleExpandedQuoteToggle} quote />
|
||||
<StatusContent status={quote_status} onClick={this.handleQuoteClick} expanded={!quote_status.get('hidden')} onExpandedToggle={this.handleExpandedQuoteToggle} quote />
|
||||
{quote_media}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -22,8 +22,6 @@ import {
|
|||
deleteStatus,
|
||||
hideStatus,
|
||||
revealStatus,
|
||||
hideQuote,
|
||||
revealQuote,
|
||||
} from '../../../actions/statuses';
|
||||
import { initMuteModal } from '../../../actions/mutes';
|
||||
import { initBlockModal } from '../../../actions/blocks';
|
||||
|
@ -182,14 +180,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
|||
}
|
||||
},
|
||||
|
||||
onQuoteToggleHidden (status) {
|
||||
if (status.get('quote_hidden')) {
|
||||
dispatch(revealQuote(status.get('id')));
|
||||
} else {
|
||||
dispatch(hideQuote(status.get('id')));
|
||||
}
|
||||
},
|
||||
|
||||
addEmojiReaction (status, name, domain, url, static_url) {
|
||||
dispatch(addEmojiReaction(status, name, domain, url, static_url));
|
||||
},
|
||||
|
|
|
@ -36,8 +36,6 @@ import {
|
|||
deleteStatus,
|
||||
hideStatus,
|
||||
revealStatus,
|
||||
hideQuote,
|
||||
revealQuote,
|
||||
} from '../../actions/statuses';
|
||||
import {
|
||||
unblockAccount,
|
||||
|
@ -385,14 +383,6 @@ class Status extends ImmutablePureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
handleQuoteToggleHidden = (status) => {
|
||||
if (status.get('quote_hidden')) {
|
||||
this.props.dispatch(revealQuote(status.get('id')));
|
||||
} else {
|
||||
this.props.dispatch(hideQuote(status.get('id')));
|
||||
}
|
||||
}
|
||||
|
||||
handleToggleAll = () => {
|
||||
const { status, ancestorsIds, descendantsIds } = this.props;
|
||||
const statusIds = [status.get('id')].concat(ancestorsIds.toJS(), descendantsIds.toJS());
|
||||
|
@ -658,7 +648,6 @@ class Status extends ImmutablePureComponent {
|
|||
showMedia={this.state.showMedia}
|
||||
onToggleMediaVisibility={this.handleToggleMediaVisibility}
|
||||
pictureInPicture={pictureInPicture}
|
||||
onQuoteToggleHidden={this.handleQuoteToggleHidden}
|
||||
showQuoteMedia={this.state.showQuoteMedia}
|
||||
onToggleQuoteMediaVisibility={this.handleToggleQuoteMediaVisibility}
|
||||
emojiMap={emojiMap}
|
||||
|
|
|
@ -18,8 +18,6 @@ import {
|
|||
STATUS_REVEAL,
|
||||
STATUS_HIDE,
|
||||
STATUS_COLLAPSE,
|
||||
QUOTE_REVEAL,
|
||||
QUOTE_HIDE,
|
||||
} from '../actions/statuses';
|
||||
import { TIMELINE_DELETE } from '../actions/timelines';
|
||||
import { STATUS_IMPORT, STATUSES_IMPORT } from '../actions/importer';
|
||||
|
@ -42,7 +40,7 @@ const deleteStatus = (state, id, references, quotes) => {
|
|||
});
|
||||
|
||||
quotes.forEach(ref => {
|
||||
state = state.setIn([ref, 'quote_id'], null).setIn([ref, 'quote'], null)
|
||||
state = state.setIn([ref, 'quote_id'], null).setIn([ref, 'quote'], null);
|
||||
});
|
||||
|
||||
return state.delete(id);
|
||||
|
@ -126,14 +124,6 @@ export default function statuses(state = initialState, action) {
|
|||
});
|
||||
case STATUS_COLLAPSE:
|
||||
return state.setIn([action.id, 'collapsed'], action.isCollapsed);
|
||||
case QUOTE_REVEAL:
|
||||
return state.withMutations(map => {
|
||||
action.ids.forEach(id => map.setIn([id, 'quote_hidden'], false));
|
||||
});
|
||||
case QUOTE_HIDE:
|
||||
return state.withMutations(map => {
|
||||
action.ids.forEach(id => map.setIn([id, 'quote_hidden'], true));
|
||||
});
|
||||
case TIMELINE_DELETE:
|
||||
return deleteStatus(state, action.id, action.references, action.quotes);
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue