]> cat aescling's git repositories - mastodon.git/commitdiff
added if else clause in fetchContext
authorRakib Hasan <rmhasan@gmail.com>
Sun, 19 Feb 2017 10:54:27 +0000 (10:54 +0000)
committerRakib Hasan <rmhasan@gmail.com>
Sun, 19 Feb 2017 10:55:22 +0000 (10:55 +0000)
So that if we get an error, then we will
only delete status if it is an 404 error

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

index 66b25f6f0133139286697108b3a158dde9e2ffa6..6f43539e07e534d7ad2495ea35aed745855f0bdb 100644 (file)
@@ -103,8 +103,12 @@ export function fetchContext(id) {
       dispatch(fetchContextSuccess(id, response.data.ancestors, response.data.descendants));
       dispatch(fetchStatusCard(id));
     }).catch(error => {
-      dispatch(deleteStatusSuccess(id));
-      dispatch(deleteFromTimelines(id));
+      if (error.response.status == 404){
+        dispatch(deleteStatusSuccess(id));
+        dispatch(deleteFromTimelines(id));
+      }else{
+        dispatch(fetchContextFail(id, error));
+      }
     });
   };
 };