Skip to content

Commit

Permalink
Make addReaction and removeReaction optional props
Browse files Browse the repository at this point in the history
This prevents things from breaking with embeds.
  • Loading branch information
TheEssem committed Sep 23, 2024
1 parent 1b3a85d commit 3460be4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/javascript/flavours/glitch/components/status_reactions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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,
};
Expand All @@ -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'));
}
};
Expand Down

0 comments on commit 3460be4

Please sign in to comment.