about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions/statuses.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-05 20:15:43 +0100
committerThibaut Girka <thib@sitedethib.com>2019-03-05 21:35:03 +0100
commit0d19fcc2fb8579a61b87206a9376cf113d82ccf4 (patch)
tree2e4e7a109ad51ceecf7c48b5c7a932a7ffa1673d /app/javascript/flavours/glitch/actions/statuses.js
parentcce1c3252f271bb5daa5ace05c971d6e1b8f298d (diff)
Port upstream refactoring of reducers and actions
Also includes 9e45b051cfea667f9ca3d3c72d13022259315090
Diffstat (limited to 'app/javascript/flavours/glitch/actions/statuses.js')
-rw-r--r--app/javascript/flavours/glitch/actions/statuses.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/actions/statuses.js b/app/javascript/flavours/glitch/actions/statuses.js
index 6183f3c03..13ce782e6 100644
--- a/app/javascript/flavours/glitch/actions/statuses.js
+++ b/app/javascript/flavours/glitch/actions/statuses.js
@@ -1,6 +1,7 @@
 import api from 'flavours/glitch/util/api';
 
 import { deleteFromTimelines } from './timelines';
+import { importFetchedStatus, importFetchedStatuses } from './importer';
 
 export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST';
 export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS';
@@ -45,17 +46,17 @@ export function fetchStatus(id) {
     dispatch(fetchStatusRequest(id, skipLoading));
 
     api(getState).get(`/api/v1/statuses/${id}`).then(response => {
-      dispatch(fetchStatusSuccess(response.data, skipLoading));
+      dispatch(importFetchedStatus(response.data));
+      dispatch(fetchStatusSuccess(skipLoading));
     }).catch(error => {
       dispatch(fetchStatusFail(id, error, skipLoading));
     });
   };
 };
 
-export function fetchStatusSuccess(status, skipLoading) {
+export function fetchStatusSuccess(skipLoading) {
   return {
     type: STATUS_FETCH_SUCCESS,
-    status,
     skipLoading,
   };
 };
@@ -127,6 +128,7 @@ export function fetchContext(id) {
     dispatch(fetchContextRequest(id));
 
     api(getState).get(`/api/v1/statuses/${id}/context`).then(response => {
+      dispatch(importFetchedStatuses(response.data.ancestors.concat(response.data.descendants)));
       dispatch(fetchContextSuccess(id, response.data.ancestors, response.data.descendants));
 
     }).catch(error => {