mirror of
https://github.com/funamitech/mastodon
synced 2024-11-30 15:58:28 +09:00
Make addReaction and removeReaction optional props
This prevents things from breaking with embeds.
This commit is contained in:
parent
55cd0e37a2
commit
a728b77de2
@ -21,9 +21,9 @@ export default class StatusReactions extends ImmutablePureComponent {
|
|||||||
statusId: PropTypes.string.isRequired,
|
statusId: PropTypes.string.isRequired,
|
||||||
reactions: ImmutablePropTypes.list.isRequired,
|
reactions: ImmutablePropTypes.list.isRequired,
|
||||||
numVisible: PropTypes.number,
|
numVisible: PropTypes.number,
|
||||||
addReaction: PropTypes.func.isRequired,
|
addReaction: PropTypes.func,
|
||||||
canReact: PropTypes.bool.isRequired,
|
canReact: PropTypes.bool.isRequired,
|
||||||
removeReaction: PropTypes.func.isRequired,
|
removeReaction: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
willEnter() {
|
willEnter() {
|
||||||
@ -78,8 +78,8 @@ class Reaction extends ImmutablePureComponent {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
statusId: PropTypes.string,
|
statusId: PropTypes.string,
|
||||||
reaction: ImmutablePropTypes.map.isRequired,
|
reaction: ImmutablePropTypes.map.isRequired,
|
||||||
addReaction: PropTypes.func.isRequired,
|
addReaction: PropTypes.func,
|
||||||
removeReaction: PropTypes.func.isRequired,
|
removeReaction: PropTypes.func,
|
||||||
canReact: PropTypes.bool.isRequired,
|
canReact: PropTypes.bool.isRequired,
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
};
|
};
|
||||||
@ -91,9 +91,9 @@ class Reaction extends ImmutablePureComponent {
|
|||||||
handleClick = () => {
|
handleClick = () => {
|
||||||
const { reaction, statusId, addReaction, removeReaction } = this.props;
|
const { reaction, statusId, addReaction, removeReaction } = this.props;
|
||||||
|
|
||||||
if (reaction.get('me')) {
|
if (reaction.get('me') && removeReaction) {
|
||||||
removeReaction(statusId, reaction.get('name'));
|
removeReaction(statusId, reaction.get('name'));
|
||||||
} else {
|
} else if (addReaction) {
|
||||||
addReaction(statusId, reaction.get('name'));
|
addReaction(statusId, reaction.get('name'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user