From f392030ab82a70086f93bb02c3faab53c3fbd28e Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 23 Jan 2017 21:09:27 +0100
Subject: Add /api/v1/notifications/clear, non-existing link cards for statuses
 will now return empty hash instead of throwing a 404 error. When following,
 merge into timeline will filter statuses

---
 app/assets/javascripts/components/actions/cards.jsx | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'app/assets/javascripts/components/actions/cards.jsx')

diff --git a/app/assets/javascripts/components/actions/cards.jsx b/app/assets/javascripts/components/actions/cards.jsx
index ee421d5d7..714e80525 100644
--- a/app/assets/javascripts/components/actions/cards.jsx
+++ b/app/assets/javascripts/components/actions/cards.jsx
@@ -9,13 +9,12 @@ export function fetchStatusCard(id) {
     dispatch(fetchStatusCardRequest(id));
 
     api(getState).get(`/api/v1/statuses/${id}/card`).then(response => {
-      dispatch(fetchStatusCardSuccess(id, response.data));
-    }).catch(error => {
-      if (error.response.status === 404) {
-        // This is fine
+      if (response.data.length === 0) {
         return;
       }
 
+      dispatch(fetchStatusCardSuccess(id, response.data));
+    }).catch(error => {
       dispatch(fetchStatusCardFail(id, error));
     });
   };
-- 
cgit 

