about summary refs log tree commit diff
path: root/app/assets/javascripts/components/actions
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-03 20:16:14 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-03 20:16:14 +0100
commit6d26bfd14706872f6e4d1c3a3e45b00d81cf86cb (patch)
tree2277f67ffb45c76ea83f1b8416e726eb48f9c415 /app/assets/javascripts/components/actions
parent0405ef977a3ba37b3da472733e59be6db7bd7b99 (diff)
Add list of who reblogged status
Diffstat (limited to 'app/assets/javascripts/components/actions')
-rw-r--r--app/assets/javascripts/components/actions/interactions.jsx38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/assets/javascripts/components/actions/interactions.jsx b/app/assets/javascripts/components/actions/interactions.jsx
index ce7797eaa..b3569d0b3 100644
--- a/app/assets/javascripts/components/actions/interactions.jsx
+++ b/app/assets/javascripts/components/actions/interactions.jsx
@@ -16,6 +16,10 @@ export const UNFAVOURITE_REQUEST = 'UNFAVOURITE_REQUEST';
 export const UNFAVOURITE_SUCCESS = 'UNFAVOURITE_SUCCESS';
 export const UNFAVOURITE_FAIL    = 'UNFAVOURITE_FAIL';
 
+export const REBLOGS_FETCH_REQUEST = 'REBLOGS_FETCH_REQUEST';
+export const REBLOGS_FETCH_SUCCESS = 'REBLOGS_FETCH_SUCCESS';
+export const REBLOGS_FETCH_FAIL    = 'REBLOGS_FETCH_FAIL';
+
 export function reblog(status) {
   return function (dispatch, getState) {
     dispatch(reblogRequest(status));
@@ -157,3 +161,37 @@ export function unfavouriteFail(status, error) {
     error: error
   };
 };
+
+export function fetchReblogs(id) {
+  return (dispatch, getState) => {
+    dispatch(fetchReblogsRequest(id));
+
+    api(getState).get(`/api/v1/statuses/${id}/reblogged_by`).then(response => {
+      dispatch(fetchReblogsSuccess(id, response.data));
+    }).catch(error => {
+      dispatch(fetchReblogsFail(id, error));
+    });
+  };
+};
+
+export function fetchReblogsRequest(id) {
+  return {
+    type: REBLOGS_FETCH_REQUEST,
+    id
+  };
+};
+
+export function fetchReblogsSuccess(id, accounts) {
+  return {
+    type: REBLOGS_FETCH_SUCCESS,
+    id,
+    accounts
+  };
+};
+
+export function fetchReblogsFail(id, error) {
+  return {
+    type: REBLOGS_FETCH_FAIL,
+    error
+  };
+};