mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-29 02:51:37 +01:00
Make addReaction and removeReaction optional props
This prevents things from breaking with embeds.
This commit is contained in:
parent
e5b5f5c018
commit
8afbeda3d4
1 changed files with 6 additions and 6 deletions
|
@ -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'));
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue