about summary refs log tree commit diff
path: root/app/assets/javascripts/components/reducers/timelines.jsx
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-22 21:10:36 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-22 21:10:36 +0200
commitb1a670af8d098c33a8938662f5c0bd60674ea683 (patch)
tree9fe4a0fce5df85e7364e514be860649f7111233a /app/assets/javascripts/components/reducers/timelines.jsx
parent2a84271e85564928c4b5e241d7d3bde69fef40ed (diff)
Handle remote account mentions a little better by trying a URL lookup in the db
Diffstat (limited to 'app/assets/javascripts/components/reducers/timelines.jsx')
-rw-r--r--app/assets/javascripts/components/reducers/timelines.jsx13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/assets/javascripts/components/reducers/timelines.jsx b/app/assets/javascripts/components/reducers/timelines.jsx
index 8dd9c3b1f..9180b17a2 100644
--- a/app/assets/javascripts/components/reducers/timelines.jsx
+++ b/app/assets/javascripts/components/reducers/timelines.jsx
@@ -28,7 +28,8 @@ const initialState = Immutable.Map({
   accounts_timelines: Immutable.Map(),
   me: null,
   ancestors: Immutable.Map(),
-  descendants: Immutable.Map()
+  descendants: Immutable.Map(),
+  relationships: Immutable.Map()
 });
 
 export function selectStatus(state, id) {
@@ -142,6 +143,11 @@ function normalizeAccount(state, account) {
   return state.setIn(['accounts', account.get('id')], account);
 };
 
+function setSelf(state, account) {
+  state = normalizeAccount(state, account);
+  return state.set('me', account.get('id'));
+};
+
 function normalizeContext(state, status, ancestors, descendants) {
   state = normalizeStatus(state, status);
 
@@ -175,10 +181,7 @@ export default function timelines(state = initialState, action) {
     case FAVOURITE_SUCCESS:
       return normalizeStatus(state, Immutable.fromJS(action.response));
     case ACCOUNT_SET_SELF:
-      return state.withMutations(map => {
-        map.setIn(['accounts', action.account.id], Immutable.fromJS(action.account));
-        map.set('me', action.account.id);
-      });
+      return setSelf(state, Immutable.fromJS(action.account));
     case ACCOUNT_FETCH_SUCCESS:
     case FOLLOW_SUBMIT_SUCCESS:
     case ACCOUNT_FOLLOW_SUCCESS: