From a1e96ae94fbdad5b5953edd705717de4e1ce60eb Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 17 Feb 2017 02:33:10 +0100 Subject: Add foreign key to prevent reblogs of non-existent (after race conditions) statuses from happening Fix issue with detailed status view not supporting unreblogging/unfavouriting --- app/assets/javascripts/components/features/status/index.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/assets') diff --git a/app/assets/javascripts/components/features/status/index.jsx b/app/assets/javascripts/components/features/status/index.jsx index e269bb661..40c0460a5 100644 --- a/app/assets/javascripts/components/features/status/index.jsx +++ b/app/assets/javascripts/components/features/status/index.jsx @@ -66,7 +66,11 @@ const Status = React.createClass({ }, handleFavouriteClick (status) { - this.props.dispatch(favourite(status)); + if (status.get('favourited')) { + this.props.dispatch(unfavourite(status)); + } else { + this.props.dispatch(favourite(status)); + } }, handleReplyClick (status) { @@ -74,7 +78,11 @@ const Status = React.createClass({ }, handleReblogClick (status) { - this.props.dispatch(reblog(status)); + if (status.get('reblogged')) { + this.props.dispatch(unreblog(status)); + } else { + this.props.dispatch(reblog(status)); + } }, handleDeleteClick (status) { -- cgit