From cbc50016eb3d0a46e76aca9ed199b036ce20abdb Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Wed, 23 Nov 2016 23:34:12 +0100
Subject: Follow/unfollow button outside of dropdown, also make favs/reblogs
 update indicator instantly and then adjust to failure later if the request
 fails

---
 app/assets/javascripts/components/reducers/statuses.jsx | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'app/assets/javascripts/components/reducers/statuses.jsx')

diff --git a/app/assets/javascripts/components/reducers/statuses.jsx b/app/assets/javascripts/components/reducers/statuses.jsx
index f42b1a481..c740b6d64 100644
--- a/app/assets/javascripts/components/reducers/statuses.jsx
+++ b/app/assets/javascripts/components/reducers/statuses.jsx
@@ -1,7 +1,11 @@
 import {
+  REBLOG_REQUEST,
   REBLOG_SUCCESS,
+  REBLOG_FAIL,
   UNREBLOG_SUCCESS,
+  FAVOURITE_REQUEST,
   FAVOURITE_SUCCESS,
+  FAVOURITE_FAIL,
   UNFAVOURITE_SUCCESS
 } from '../actions/interactions';
 import {
@@ -82,6 +86,14 @@ export default function statuses(state = initialState, action) {
     case FAVOURITE_SUCCESS:
     case UNFAVOURITE_SUCCESS:
       return normalizeStatus(state, action.response);
+    case FAVOURITE_REQUEST:
+      return state.setIn([action.status.get('id'), 'favourited'], true);
+    case FAVOURITE_FAIL:
+      return state.setIn([action.status.get('id'), 'favourited'], false);
+    case REBLOG_REQUEST:
+      return state.setIn([action.status.get('id'), 'reblogged'], true);
+    case REBLOG_FAIL:
+      return state.setIn([action.status.get('id'), 'reblogged'], false);
     case TIMELINE_REFRESH_SUCCESS:
     case TIMELINE_EXPAND_SUCCESS:
     case ACCOUNT_TIMELINE_FETCH_SUCCESS:
-- 
cgit 

