1
0

Make addReaction and removeReaction optional props

This prevents things from breaking with embeds.
This commit is contained in:
Essem 2024-09-13 16:32:47 -05:00
parent 55cd0e37a2
commit a728b77de2
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C

View File

@ -21,9 +21,9 @@ export default class StatusReactions extends ImmutablePureComponent {
statusId: PropTypes.string.isRequired,
reactions: ImmutablePropTypes.list.isRequired,
numVisible: PropTypes.number,
addReaction: PropTypes.func.isRequired,
addReaction: PropTypes.func,
canReact: PropTypes.bool.isRequired,
removeReaction: PropTypes.func.isRequired,
removeReaction: PropTypes.func,
};
willEnter() {
@ -78,8 +78,8 @@ class Reaction extends ImmutablePureComponent {
static propTypes = {
statusId: PropTypes.string,
reaction: ImmutablePropTypes.map.isRequired,
addReaction: PropTypes.func.isRequired,
removeReaction: PropTypes.func.isRequired,
addReaction: PropTypes.func,
removeReaction: PropTypes.func,
canReact: PropTypes.bool.isRequired,
style: PropTypes.object,
};
@ -91,9 +91,9 @@ class Reaction extends ImmutablePureComponent {
handleClick = () => {
const { reaction, statusId, addReaction, removeReaction } = this.props;
if (reaction.get('me')) {
if (reaction.get('me') && removeReaction) {
removeReaction(statusId, reaction.get('name'));
} else {
} else if (addReaction) {
addReaction(statusId, reaction.get('name'));
}
};