]> cat aescling's git repositories - mastodon.git/commitdiff
Prevent potential issue with public/hashtag statuses arriving after
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 1 Feb 2017 23:45:57 +0000 (00:45 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 1 Feb 2017 23:49:25 +0000 (00:49 +0100)
they have been loaded and favourited/reblogged from another source

Since the status JSON returned from public/hashtag streams does not
contain favourited/reblogged attributes, merging them should not
override existing ones.

app/assets/javascripts/components/reducers/statuses.jsx

index 084b6304c0cc3fc777405c8127e3612283e90213..6323e0fbed76915d3ce7b511b4014ec138789cdb 100644 (file)
@@ -46,7 +46,7 @@ const normalizeStatus = (state, status) => {
     status.reblog = status.reblog.id;
   }
 
-  return state.set(status.id, Immutable.fromJS(status));
+  return state.update(status.id, Immutable.Map(), map => map.mergeDeep(Immutable.fromJS(status)));
 };
 
 const normalizeStatuses = (state, statuses) => {