about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/status
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-17 02:33:10 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-17 02:33:10 +0100
commita1e96ae94fbdad5b5953edd705717de4e1ce60eb (patch)
treea0b650b9e759359569416b7dbde1297de601c414 /app/assets/javascripts/components/features/status
parent5ddad41245098f1ab931f732f8b48655a86d57b0 (diff)
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
Diffstat (limited to 'app/assets/javascripts/components/features/status')
-rw-r--r--app/assets/javascripts/components/features/status/index.jsx12
1 files changed, 10 insertions, 2 deletions
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) {