From 3460be49d2a16f23fc3b664c0b08000212149563 Mon Sep 17 00:00:00 2001 From: Essem Date: Fri, 13 Sep 2024 16:32:47 -0500 Subject: [PATCH] Make addReaction and removeReaction optional props This prevents things from breaking with embeds. --- .../flavours/glitch/components/status_reactions.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/javascript/flavours/glitch/components/status_reactions.jsx b/app/javascript/flavours/glitch/components/status_reactions.jsx index 81443d20555e14..d750b5f23359d2 100644 --- a/app/javascript/flavours/glitch/components/status_reactions.jsx +++ b/app/javascript/flavours/glitch/components/status_reactions.jsx @@ -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')); } };