cleanup frontend emoji reaction code

This commit is contained in:
fef 2022-11-29 08:54:35 +00:00 committed by neatchee
commit d249994de8
11 changed files with 64 additions and 71 deletions

View file

@ -144,7 +144,7 @@ class ActionBar extends React.PureComponent {
navigator.clipboard.writeText(url);
};
nop = () => {}
nop = () => {} // hack for reaction add button
render () {
const { status, intl } = this.props;

View file

@ -20,7 +20,7 @@ import Icon from 'flavours/glitch/components/icon';
import AnimatedNumber from 'flavours/glitch/components/animated_number';
import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder';
import EditedTimestamp from 'flavours/glitch/components/edited_timestamp';
import StatusReactionsBar from '../../../components/status_reactions_bar';
import StatusReactions from '../../../components/status_reactions';
class DetailedStatus extends ImmutablePureComponent {
@ -328,7 +328,7 @@ class DetailedStatus extends ImmutablePureComponent {
disabled
/>
<StatusReactionsBar
<StatusReactions
statusId={status.get('id')}
reactions={status.get('reactions')}
addReaction={this.props.onReactionAdd}

View file

@ -30,8 +30,8 @@ import {
unreblog,
pin,
unpin,
statusAddReaction,
statusRemoveReaction,
addReaction,
removeReaction,
} from 'flavours/glitch/actions/interactions';
import {
replyCompose,
@ -58,7 +58,7 @@ import { autoUnfoldCW } from 'flavours/glitch/utils/content_warning';
import { textForScreenReader, defaultMediaVisibility } from 'flavours/glitch/components/status';
import Icon from 'flavours/glitch/components/icon';
import { Helmet } from 'react-helmet';
import buildCustomEmojiMap from '../../utils/emoji_map';
import { makeCustomEmojiMap } from '../../selectors';
const messages = defineMessages({
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
@ -151,7 +151,7 @@ const makeMapStateToProps = () => {
askReplyConfirmation: state.getIn(['local_settings', 'confirm_before_clearing_draft']) && state.getIn(['compose', 'text']).trim().length !== 0,
domain: state.getIn(['meta', 'domain']),
pictureInPicture: getPictureInPicture(state, { id: props.params.statusId }),
emojiMap: buildCustomEmojiMap(state),
emojiMap: makeCustomEmojiMap(state),
};
};
@ -303,7 +303,7 @@ class Status extends ImmutablePureComponent {
const { signedIn } = this.context.identity;
if (signedIn) {
dispatch(statusAddReaction(statusId, name));
dispatch(addReaction(statusId, name));
} else {
dispatch(openModal('INTERACTION', {
type: 'reaction_add',
@ -314,12 +314,7 @@ class Status extends ImmutablePureComponent {
}
handleReactionRemove = (statusId, name) => {
const { dispatch } = this.props;
const { signedIn } = this.context.identity;
if (signedIn) {
dispatch(statusRemoveReaction(statusId, name));
}
this.props.dispatch(removeReaction(statusId, name));
}
handlePin = (status) => {