Compose: Show 'Replying to a post' if unchecked all mentions

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
improve-ci
marcin mikołajczak 2022-02-21 09:56:23 +01:00
rodzic 6ceecc08b2
commit 2635d9b109
2 zmienionych plików z 21 dodań i 2 usunięć

Wyświetl plik

@ -11,6 +11,7 @@ class ReplyMentions extends ImmutablePureComponent {
onOpenMentionsModal: PropTypes.func.isRequired,
explicitAddressing: PropTypes.bool,
to: ImmutablePropTypes.orderedSet,
parentTo: ImmutablePropTypes.orderedSet,
isReply: PropTypes.bool,
};
@ -21,12 +22,23 @@ class ReplyMentions extends ImmutablePureComponent {
}
render() {
const { explicitAddressing, to, isReply } = this.props;
const { explicitAddressing, to, parentTo, isReply } = this.props;
if (!explicitAddressing || !isReply || !to || to.size === 0) {
if (!explicitAddressing || !isReply || !to || (parentTo.size === 0)) {
return null;
}
if (to.size === 0) {
return (
<a href='#' className='reply-mentions' onClick={this.handleClick}>
<FormattedMessage
id='reply_mentions.reply_empty'
defaultMessage='Replying to post'
/>
</a>
);
}
return (
<a href='#' className='reply-mentions' onClick={this.handleClick}>
<FormattedMessage

Wyświetl plik

@ -1,6 +1,7 @@
import { connect } from 'react-redux';
import { openModal } from 'soapbox/actions/modal';
import { statusToMentionsAccountIdsArray } from 'soapbox/reducers/compose';
import { makeGetStatus } from 'soapbox/selectors';
import { getFeatures } from 'soapbox/utils/features';
@ -28,8 +29,14 @@ const makeMapStateToProps = () => {
}
const to = state.getIn(['compose', 'to']);
const me = state.get('me');
const account = state.getIn(['accounts', me]);
const parentTo = statusToMentionsAccountIdsArray(state, status, account);
return {
to,
parentTo,
isReply: true,
explicitAddressing: true,
};