From 3731230c6d25f248afa8a17b62b3db70fdfe1e03 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Thu, 3 Nov 2016 16:57:44 +0100
Subject: Allow @username@domain/@username in follow form, prevent duplicate
 accounts created via remote look-up when domains differ but point to the same
 resource

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

(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 a1f1f07f1..69c0e6193 100644
--- a/app/assets/javascripts/components/reducers/statuses.jsx
+++ b/app/assets/javascripts/components/reducers/statuses.jsx
@@ -21,14 +21,14 @@ import {
 import Immutable from 'immutable';
 
 const normalizeStatus = (state, status) => {
-  status = status.set('account', status.getIn(['account', 'id']));
+  status.account = status.account.id;
 
-  if (status.getIn(['reblog', 'id'])) {
-    state  = normalizeStatus(state, status.get('reblog'));
-    status = status.set('reblog', status.getIn(['reblog', 'id']));
+  if (status.reblog && status.reblog.id) {
+    state         = normalizeStatus(state, status.reblog);
+    status.reblog = status.reblog.id;
   }
 
-  return state.set(status.get('id'), status);
+  return state.set(status.id, Immutable.fromJS(status));
 };
 
 const normalizeStatuses = (state, statuses) => {
@@ -53,18 +53,18 @@ export default function statuses(state = initialState, action) {
   switch(action.type) {
     case TIMELINE_UPDATE:
     case STATUS_FETCH_SUCCESS:
-      return normalizeStatus(state, Immutable.fromJS(action.status));
+      return normalizeStatus(state, action.status);
     case REBLOG_SUCCESS:
     case UNREBLOG_SUCCESS:
     case FAVOURITE_SUCCESS:
     case UNFAVOURITE_SUCCESS:
-      return normalizeStatus(state, Immutable.fromJS(action.response));
+      return normalizeStatus(state, action.response);
     case TIMELINE_REFRESH_SUCCESS:
     case TIMELINE_EXPAND_SUCCESS:
     case ACCOUNT_TIMELINE_FETCH_SUCCESS:
     case ACCOUNT_TIMELINE_EXPAND_SUCCESS:
     case CONTEXT_FETCH_SUCCESS:
-      return normalizeStatuses(state, Immutable.fromJS(action.statuses));
+      return normalizeStatuses(state, action.statuses);
     case TIMELINE_DELETE:
       return deleteStatus(state, action.id, action.references);
     default:
-- 
cgit 

