From bc4fa6b198557a7f3989eb0865e2c77ac7451d29 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Sun, 3 Dec 2017 23:26:40 -0800 Subject: Rename themes -> flavours ? ? --- app/javascript/themes/glitch/actions/accounts.js | 661 --------------------- app/javascript/themes/glitch/actions/alerts.js | 24 - app/javascript/themes/glitch/actions/blocks.js | 82 --- app/javascript/themes/glitch/actions/bundles.js | 25 - app/javascript/themes/glitch/actions/cards.js | 52 -- app/javascript/themes/glitch/actions/columns.js | 40 -- app/javascript/themes/glitch/actions/compose.js | 398 ------------- .../themes/glitch/actions/domain_blocks.js | 117 ---- app/javascript/themes/glitch/actions/emojis.js | 14 - app/javascript/themes/glitch/actions/favourites.js | 83 --- .../themes/glitch/actions/height_cache.js | 17 - .../themes/glitch/actions/interactions.js | 313 ---------- .../themes/glitch/actions/local_settings.js | 24 - app/javascript/themes/glitch/actions/modal.js | 16 - app/javascript/themes/glitch/actions/mutes.js | 103 ---- .../themes/glitch/actions/notifications.js | 265 --------- app/javascript/themes/glitch/actions/onboarding.js | 14 - .../themes/glitch/actions/pin_statuses.js | 40 -- .../themes/glitch/actions/push_notifications.js | 52 -- app/javascript/themes/glitch/actions/reports.js | 80 --- app/javascript/themes/glitch/actions/search.js | 73 --- app/javascript/themes/glitch/actions/settings.js | 31 - app/javascript/themes/glitch/actions/statuses.js | 217 ------- app/javascript/themes/glitch/actions/store.js | 17 - app/javascript/themes/glitch/actions/streaming.js | 54 -- app/javascript/themes/glitch/actions/timelines.js | 208 ------- 26 files changed, 3020 deletions(-) delete mode 100644 app/javascript/themes/glitch/actions/accounts.js delete mode 100644 app/javascript/themes/glitch/actions/alerts.js delete mode 100644 app/javascript/themes/glitch/actions/blocks.js delete mode 100644 app/javascript/themes/glitch/actions/bundles.js delete mode 100644 app/javascript/themes/glitch/actions/cards.js delete mode 100644 app/javascript/themes/glitch/actions/columns.js delete mode 100644 app/javascript/themes/glitch/actions/compose.js delete mode 100644 app/javascript/themes/glitch/actions/domain_blocks.js delete mode 100644 app/javascript/themes/glitch/actions/emojis.js delete mode 100644 app/javascript/themes/glitch/actions/favourites.js delete mode 100644 app/javascript/themes/glitch/actions/height_cache.js delete mode 100644 app/javascript/themes/glitch/actions/interactions.js delete mode 100644 app/javascript/themes/glitch/actions/local_settings.js delete mode 100644 app/javascript/themes/glitch/actions/modal.js delete mode 100644 app/javascript/themes/glitch/actions/mutes.js delete mode 100644 app/javascript/themes/glitch/actions/notifications.js delete mode 100644 app/javascript/themes/glitch/actions/onboarding.js delete mode 100644 app/javascript/themes/glitch/actions/pin_statuses.js delete mode 100644 app/javascript/themes/glitch/actions/push_notifications.js delete mode 100644 app/javascript/themes/glitch/actions/reports.js delete mode 100644 app/javascript/themes/glitch/actions/search.js delete mode 100644 app/javascript/themes/glitch/actions/settings.js delete mode 100644 app/javascript/themes/glitch/actions/statuses.js delete mode 100644 app/javascript/themes/glitch/actions/store.js delete mode 100644 app/javascript/themes/glitch/actions/streaming.js delete mode 100644 app/javascript/themes/glitch/actions/timelines.js (limited to 'app/javascript/themes/glitch/actions') diff --git a/app/javascript/themes/glitch/actions/accounts.js b/app/javascript/themes/glitch/actions/accounts.js deleted file mode 100644 index f1a8c5471..000000000 --- a/app/javascript/themes/glitch/actions/accounts.js +++ /dev/null @@ -1,661 +0,0 @@ -import api, { getLinks } from 'themes/glitch/util/api'; - -export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST'; -export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS'; -export const ACCOUNT_FETCH_FAIL = 'ACCOUNT_FETCH_FAIL'; - -export const ACCOUNT_FOLLOW_REQUEST = 'ACCOUNT_FOLLOW_REQUEST'; -export const ACCOUNT_FOLLOW_SUCCESS = 'ACCOUNT_FOLLOW_SUCCESS'; -export const ACCOUNT_FOLLOW_FAIL = 'ACCOUNT_FOLLOW_FAIL'; - -export const ACCOUNT_UNFOLLOW_REQUEST = 'ACCOUNT_UNFOLLOW_REQUEST'; -export const ACCOUNT_UNFOLLOW_SUCCESS = 'ACCOUNT_UNFOLLOW_SUCCESS'; -export const ACCOUNT_UNFOLLOW_FAIL = 'ACCOUNT_UNFOLLOW_FAIL'; - -export const ACCOUNT_BLOCK_REQUEST = 'ACCOUNT_BLOCK_REQUEST'; -export const ACCOUNT_BLOCK_SUCCESS = 'ACCOUNT_BLOCK_SUCCESS'; -export const ACCOUNT_BLOCK_FAIL = 'ACCOUNT_BLOCK_FAIL'; - -export const ACCOUNT_UNBLOCK_REQUEST = 'ACCOUNT_UNBLOCK_REQUEST'; -export const ACCOUNT_UNBLOCK_SUCCESS = 'ACCOUNT_UNBLOCK_SUCCESS'; -export const ACCOUNT_UNBLOCK_FAIL = 'ACCOUNT_UNBLOCK_FAIL'; - -export const ACCOUNT_MUTE_REQUEST = 'ACCOUNT_MUTE_REQUEST'; -export const ACCOUNT_MUTE_SUCCESS = 'ACCOUNT_MUTE_SUCCESS'; -export const ACCOUNT_MUTE_FAIL = 'ACCOUNT_MUTE_FAIL'; - -export const ACCOUNT_UNMUTE_REQUEST = 'ACCOUNT_UNMUTE_REQUEST'; -export const ACCOUNT_UNMUTE_SUCCESS = 'ACCOUNT_UNMUTE_SUCCESS'; -export const ACCOUNT_UNMUTE_FAIL = 'ACCOUNT_UNMUTE_FAIL'; - -export const FOLLOWERS_FETCH_REQUEST = 'FOLLOWERS_FETCH_REQUEST'; -export const FOLLOWERS_FETCH_SUCCESS = 'FOLLOWERS_FETCH_SUCCESS'; -export const FOLLOWERS_FETCH_FAIL = 'FOLLOWERS_FETCH_FAIL'; - -export const FOLLOWERS_EXPAND_REQUEST = 'FOLLOWERS_EXPAND_REQUEST'; -export const FOLLOWERS_EXPAND_SUCCESS = 'FOLLOWERS_EXPAND_SUCCESS'; -export const FOLLOWERS_EXPAND_FAIL = 'FOLLOWERS_EXPAND_FAIL'; - -export const FOLLOWING_FETCH_REQUEST = 'FOLLOWING_FETCH_REQUEST'; -export const FOLLOWING_FETCH_SUCCESS = 'FOLLOWING_FETCH_SUCCESS'; -export const FOLLOWING_FETCH_FAIL = 'FOLLOWING_FETCH_FAIL'; - -export const FOLLOWING_EXPAND_REQUEST = 'FOLLOWING_EXPAND_REQUEST'; -export const FOLLOWING_EXPAND_SUCCESS = 'FOLLOWING_EXPAND_SUCCESS'; -export const FOLLOWING_EXPAND_FAIL = 'FOLLOWING_EXPAND_FAIL'; - -export const RELATIONSHIPS_FETCH_REQUEST = 'RELATIONSHIPS_FETCH_REQUEST'; -export const RELATIONSHIPS_FETCH_SUCCESS = 'RELATIONSHIPS_FETCH_SUCCESS'; -export const RELATIONSHIPS_FETCH_FAIL = 'RELATIONSHIPS_FETCH_FAIL'; - -export const FOLLOW_REQUESTS_FETCH_REQUEST = 'FOLLOW_REQUESTS_FETCH_REQUEST'; -export const FOLLOW_REQUESTS_FETCH_SUCCESS = 'FOLLOW_REQUESTS_FETCH_SUCCESS'; -export const FOLLOW_REQUESTS_FETCH_FAIL = 'FOLLOW_REQUESTS_FETCH_FAIL'; - -export const FOLLOW_REQUESTS_EXPAND_REQUEST = 'FOLLOW_REQUESTS_EXPAND_REQUEST'; -export const FOLLOW_REQUESTS_EXPAND_SUCCESS = 'FOLLOW_REQUESTS_EXPAND_SUCCESS'; -export const FOLLOW_REQUESTS_EXPAND_FAIL = 'FOLLOW_REQUESTS_EXPAND_FAIL'; - -export const FOLLOW_REQUEST_AUTHORIZE_REQUEST = 'FOLLOW_REQUEST_AUTHORIZE_REQUEST'; -export const FOLLOW_REQUEST_AUTHORIZE_SUCCESS = 'FOLLOW_REQUEST_AUTHORIZE_SUCCESS'; -export const FOLLOW_REQUEST_AUTHORIZE_FAIL = 'FOLLOW_REQUEST_AUTHORIZE_FAIL'; - -export const FOLLOW_REQUEST_REJECT_REQUEST = 'FOLLOW_REQUEST_REJECT_REQUEST'; -export const FOLLOW_REQUEST_REJECT_SUCCESS = 'FOLLOW_REQUEST_REJECT_SUCCESS'; -export const FOLLOW_REQUEST_REJECT_FAIL = 'FOLLOW_REQUEST_REJECT_FAIL'; - -export function fetchAccount(id) { - return (dispatch, getState) => { - dispatch(fetchRelationships([id])); - - if (getState().getIn(['accounts', id], null) !== null) { - return; - } - - dispatch(fetchAccountRequest(id)); - - api(getState).get(`/api/v1/accounts/${id}`).then(response => { - dispatch(fetchAccountSuccess(response.data)); - }).catch(error => { - dispatch(fetchAccountFail(id, error)); - }); - }; -}; - -export function fetchAccountRequest(id) { - return { - type: ACCOUNT_FETCH_REQUEST, - id, - }; -}; - -export function fetchAccountSuccess(account) { - return { - type: ACCOUNT_FETCH_SUCCESS, - account, - }; -}; - -export function fetchAccountFail(id, error) { - return { - type: ACCOUNT_FETCH_FAIL, - id, - error, - skipAlert: true, - }; -}; - -export function followAccount(id, reblogs = true) { - return (dispatch, getState) => { - const alreadyFollowing = getState().getIn(['relationships', id, 'following']); - dispatch(followAccountRequest(id)); - - api(getState).post(`/api/v1/accounts/${id}/follow`, { reblogs }).then(response => { - dispatch(followAccountSuccess(response.data, alreadyFollowing)); - }).catch(error => { - dispatch(followAccountFail(error)); - }); - }; -}; - -export function unfollowAccount(id) { - return (dispatch, getState) => { - dispatch(unfollowAccountRequest(id)); - - api(getState).post(`/api/v1/accounts/${id}/unfollow`).then(response => { - dispatch(unfollowAccountSuccess(response.data, getState().get('statuses'))); - }).catch(error => { - dispatch(unfollowAccountFail(error)); - }); - }; -}; - -export function followAccountRequest(id) { - return { - type: ACCOUNT_FOLLOW_REQUEST, - id, - }; -}; - -export function followAccountSuccess(relationship, alreadyFollowing) { - return { - type: ACCOUNT_FOLLOW_SUCCESS, - relationship, - alreadyFollowing, - }; -}; - -export function followAccountFail(error) { - return { - type: ACCOUNT_FOLLOW_FAIL, - error, - }; -}; - -export function unfollowAccountRequest(id) { - return { - type: ACCOUNT_UNFOLLOW_REQUEST, - id, - }; -}; - -export function unfollowAccountSuccess(relationship, statuses) { - return { - type: ACCOUNT_UNFOLLOW_SUCCESS, - relationship, - statuses, - }; -}; - -export function unfollowAccountFail(error) { - return { - type: ACCOUNT_UNFOLLOW_FAIL, - error, - }; -}; - -export function blockAccount(id) { - return (dispatch, getState) => { - dispatch(blockAccountRequest(id)); - - api(getState).post(`/api/v1/accounts/${id}/block`).then(response => { - // Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers - dispatch(blockAccountSuccess(response.data, getState().get('statuses'))); - }).catch(error => { - dispatch(blockAccountFail(id, error)); - }); - }; -}; - -export function unblockAccount(id) { - return (dispatch, getState) => { - dispatch(unblockAccountRequest(id)); - - api(getState).post(`/api/v1/accounts/${id}/unblock`).then(response => { - dispatch(unblockAccountSuccess(response.data)); - }).catch(error => { - dispatch(unblockAccountFail(id, error)); - }); - }; -}; - -export function blockAccountRequest(id) { - return { - type: ACCOUNT_BLOCK_REQUEST, - id, - }; -}; - -export function blockAccountSuccess(relationship, statuses) { - return { - type: ACCOUNT_BLOCK_SUCCESS, - relationship, - statuses, - }; -}; - -export function blockAccountFail(error) { - return { - type: ACCOUNT_BLOCK_FAIL, - error, - }; -}; - -export function unblockAccountRequest(id) { - return { - type: ACCOUNT_UNBLOCK_REQUEST, - id, - }; -}; - -export function unblockAccountSuccess(relationship) { - return { - type: ACCOUNT_UNBLOCK_SUCCESS, - relationship, - }; -}; - -export function unblockAccountFail(error) { - return { - type: ACCOUNT_UNBLOCK_FAIL, - error, - }; -}; - - -export function muteAccount(id, notifications) { - return (dispatch, getState) => { - dispatch(muteAccountRequest(id)); - - api(getState).post(`/api/v1/accounts/${id}/mute`, { notifications }).then(response => { - // Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers - dispatch(muteAccountSuccess(response.data, getState().get('statuses'))); - }).catch(error => { - dispatch(muteAccountFail(id, error)); - }); - }; -}; - -export function unmuteAccount(id) { - return (dispatch, getState) => { - dispatch(unmuteAccountRequest(id)); - - api(getState).post(`/api/v1/accounts/${id}/unmute`).then(response => { - dispatch(unmuteAccountSuccess(response.data)); - }).catch(error => { - dispatch(unmuteAccountFail(id, error)); - }); - }; -}; - -export function muteAccountRequest(id) { - return { - type: ACCOUNT_MUTE_REQUEST, - id, - }; -}; - -export function muteAccountSuccess(relationship, statuses) { - return { - type: ACCOUNT_MUTE_SUCCESS, - relationship, - statuses, - }; -}; - -export function muteAccountFail(error) { - return { - type: ACCOUNT_MUTE_FAIL, - error, - }; -}; - -export function unmuteAccountRequest(id) { - return { - type: ACCOUNT_UNMUTE_REQUEST, - id, - }; -}; - -export function unmuteAccountSuccess(relationship) { - return { - type: ACCOUNT_UNMUTE_SUCCESS, - relationship, - }; -}; - -export function unmuteAccountFail(error) { - return { - type: ACCOUNT_UNMUTE_FAIL, - error, - }; -}; - - -export function fetchFollowers(id) { - return (dispatch, getState) => { - dispatch(fetchFollowersRequest(id)); - - api(getState).get(`/api/v1/accounts/${id}/followers`).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - - dispatch(fetchFollowersSuccess(id, response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => { - dispatch(fetchFollowersFail(id, error)); - }); - }; -}; - -export function fetchFollowersRequest(id) { - return { - type: FOLLOWERS_FETCH_REQUEST, - id, - }; -}; - -export function fetchFollowersSuccess(id, accounts, next) { - return { - type: FOLLOWERS_FETCH_SUCCESS, - id, - accounts, - next, - }; -}; - -export function fetchFollowersFail(id, error) { - return { - type: FOLLOWERS_FETCH_FAIL, - id, - error, - }; -}; - -export function expandFollowers(id) { - return (dispatch, getState) => { - const url = getState().getIn(['user_lists', 'followers', id, 'next']); - - if (url === null) { - return; - } - - dispatch(expandFollowersRequest(id)); - - api(getState).get(url).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - - dispatch(expandFollowersSuccess(id, response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => { - dispatch(expandFollowersFail(id, error)); - }); - }; -}; - -export function expandFollowersRequest(id) { - return { - type: FOLLOWERS_EXPAND_REQUEST, - id, - }; -}; - -export function expandFollowersSuccess(id, accounts, next) { - return { - type: FOLLOWERS_EXPAND_SUCCESS, - id, - accounts, - next, - }; -}; - -export function expandFollowersFail(id, error) { - return { - type: FOLLOWERS_EXPAND_FAIL, - id, - error, - }; -}; - -export function fetchFollowing(id) { - return (dispatch, getState) => { - dispatch(fetchFollowingRequest(id)); - - api(getState).get(`/api/v1/accounts/${id}/following`).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - - dispatch(fetchFollowingSuccess(id, response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => { - dispatch(fetchFollowingFail(id, error)); - }); - }; -}; - -export function fetchFollowingRequest(id) { - return { - type: FOLLOWING_FETCH_REQUEST, - id, - }; -}; - -export function fetchFollowingSuccess(id, accounts, next) { - return { - type: FOLLOWING_FETCH_SUCCESS, - id, - accounts, - next, - }; -}; - -export function fetchFollowingFail(id, error) { - return { - type: FOLLOWING_FETCH_FAIL, - id, - error, - }; -}; - -export function expandFollowing(id) { - return (dispatch, getState) => { - const url = getState().getIn(['user_lists', 'following', id, 'next']); - - if (url === null) { - return; - } - - dispatch(expandFollowingRequest(id)); - - api(getState).get(url).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - - dispatch(expandFollowingSuccess(id, response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => { - dispatch(expandFollowingFail(id, error)); - }); - }; -}; - -export function expandFollowingRequest(id) { - return { - type: FOLLOWING_EXPAND_REQUEST, - id, - }; -}; - -export function expandFollowingSuccess(id, accounts, next) { - return { - type: FOLLOWING_EXPAND_SUCCESS, - id, - accounts, - next, - }; -}; - -export function expandFollowingFail(id, error) { - return { - type: FOLLOWING_EXPAND_FAIL, - id, - error, - }; -}; - -export function fetchRelationships(accountIds) { - return (dispatch, getState) => { - const loadedRelationships = getState().get('relationships'); - const newAccountIds = accountIds.filter(id => loadedRelationships.get(id, null) === null); - - if (newAccountIds.length === 0) { - return; - } - - dispatch(fetchRelationshipsRequest(newAccountIds)); - - api(getState).get(`/api/v1/accounts/relationships?${newAccountIds.map(id => `id[]=${id}`).join('&')}`).then(response => { - dispatch(fetchRelationshipsSuccess(response.data)); - }).catch(error => { - dispatch(fetchRelationshipsFail(error)); - }); - }; -}; - -export function fetchRelationshipsRequest(ids) { - return { - type: RELATIONSHIPS_FETCH_REQUEST, - ids, - skipLoading: true, - }; -}; - -export function fetchRelationshipsSuccess(relationships) { - return { - type: RELATIONSHIPS_FETCH_SUCCESS, - relationships, - skipLoading: true, - }; -}; - -export function fetchRelationshipsFail(error) { - return { - type: RELATIONSHIPS_FETCH_FAIL, - error, - skipLoading: true, - }; -}; - -export function fetchFollowRequests() { - return (dispatch, getState) => { - dispatch(fetchFollowRequestsRequest()); - - api(getState).get('/api/v1/follow_requests').then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null)); - }).catch(error => dispatch(fetchFollowRequestsFail(error))); - }; -}; - -export function fetchFollowRequestsRequest() { - return { - type: FOLLOW_REQUESTS_FETCH_REQUEST, - }; -}; - -export function fetchFollowRequestsSuccess(accounts, next) { - return { - type: FOLLOW_REQUESTS_FETCH_SUCCESS, - accounts, - next, - }; -}; - -export function fetchFollowRequestsFail(error) { - return { - type: FOLLOW_REQUESTS_FETCH_FAIL, - error, - }; -}; - -export function expandFollowRequests() { - return (dispatch, getState) => { - const url = getState().getIn(['user_lists', 'follow_requests', 'next']); - - if (url === null) { - return; - } - - dispatch(expandFollowRequestsRequest()); - - api(getState).get(url).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null)); - }).catch(error => dispatch(expandFollowRequestsFail(error))); - }; -}; - -export function expandFollowRequestsRequest() { - return { - type: FOLLOW_REQUESTS_EXPAND_REQUEST, - }; -}; - -export function expandFollowRequestsSuccess(accounts, next) { - return { - type: FOLLOW_REQUESTS_EXPAND_SUCCESS, - accounts, - next, - }; -}; - -export function expandFollowRequestsFail(error) { - return { - type: FOLLOW_REQUESTS_EXPAND_FAIL, - error, - }; -}; - -export function authorizeFollowRequest(id) { - return (dispatch, getState) => { - dispatch(authorizeFollowRequestRequest(id)); - - api(getState) - .post(`/api/v1/follow_requests/${id}/authorize`) - .then(() => dispatch(authorizeFollowRequestSuccess(id))) - .catch(error => dispatch(authorizeFollowRequestFail(id, error))); - }; -}; - -export function authorizeFollowRequestRequest(id) { - return { - type: FOLLOW_REQUEST_AUTHORIZE_REQUEST, - id, - }; -}; - -export function authorizeFollowRequestSuccess(id) { - return { - type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS, - id, - }; -}; - -export function authorizeFollowRequestFail(id, error) { - return { - type: FOLLOW_REQUEST_AUTHORIZE_FAIL, - id, - error, - }; -}; - - -export function rejectFollowRequest(id) { - return (dispatch, getState) => { - dispatch(rejectFollowRequestRequest(id)); - - api(getState) - .post(`/api/v1/follow_requests/${id}/reject`) - .then(() => dispatch(rejectFollowRequestSuccess(id))) - .catch(error => dispatch(rejectFollowRequestFail(id, error))); - }; -}; - -export function rejectFollowRequestRequest(id) { - return { - type: FOLLOW_REQUEST_REJECT_REQUEST, - id, - }; -}; - -export function rejectFollowRequestSuccess(id) { - return { - type: FOLLOW_REQUEST_REJECT_SUCCESS, - id, - }; -}; - -export function rejectFollowRequestFail(id, error) { - return { - type: FOLLOW_REQUEST_REJECT_FAIL, - id, - error, - }; -}; diff --git a/app/javascript/themes/glitch/actions/alerts.js b/app/javascript/themes/glitch/actions/alerts.js deleted file mode 100644 index f37fdeeb6..000000000 --- a/app/javascript/themes/glitch/actions/alerts.js +++ /dev/null @@ -1,24 +0,0 @@ -export const ALERT_SHOW = 'ALERT_SHOW'; -export const ALERT_DISMISS = 'ALERT_DISMISS'; -export const ALERT_CLEAR = 'ALERT_CLEAR'; - -export function dismissAlert(alert) { - return { - type: ALERT_DISMISS, - alert, - }; -}; - -export function clearAlert() { - return { - type: ALERT_CLEAR, - }; -}; - -export function showAlert(title, message) { - return { - type: ALERT_SHOW, - title, - message, - }; -}; diff --git a/app/javascript/themes/glitch/actions/blocks.js b/app/javascript/themes/glitch/actions/blocks.js deleted file mode 100644 index 6ba9460f0..000000000 --- a/app/javascript/themes/glitch/actions/blocks.js +++ /dev/null @@ -1,82 +0,0 @@ -import api, { getLinks } from 'themes/glitch/util/api'; -import { fetchRelationships } from './accounts'; - -export const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; -export const BLOCKS_FETCH_SUCCESS = 'BLOCKS_FETCH_SUCCESS'; -export const BLOCKS_FETCH_FAIL = 'BLOCKS_FETCH_FAIL'; - -export const BLOCKS_EXPAND_REQUEST = 'BLOCKS_EXPAND_REQUEST'; -export const BLOCKS_EXPAND_SUCCESS = 'BLOCKS_EXPAND_SUCCESS'; -export const BLOCKS_EXPAND_FAIL = 'BLOCKS_EXPAND_FAIL'; - -export function fetchBlocks() { - return (dispatch, getState) => { - dispatch(fetchBlocksRequest()); - - api(getState).get('/api/v1/blocks').then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(fetchBlocksSuccess(response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => dispatch(fetchBlocksFail(error))); - }; -}; - -export function fetchBlocksRequest() { - return { - type: BLOCKS_FETCH_REQUEST, - }; -}; - -export function fetchBlocksSuccess(accounts, next) { - return { - type: BLOCKS_FETCH_SUCCESS, - accounts, - next, - }; -}; - -export function fetchBlocksFail(error) { - return { - type: BLOCKS_FETCH_FAIL, - error, - }; -}; - -export function expandBlocks() { - return (dispatch, getState) => { - const url = getState().getIn(['user_lists', 'blocks', 'next']); - - if (url === null) { - return; - } - - dispatch(expandBlocksRequest()); - - api(getState).get(url).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(expandBlocksSuccess(response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => dispatch(expandBlocksFail(error))); - }; -}; - -export function expandBlocksRequest() { - return { - type: BLOCKS_EXPAND_REQUEST, - }; -}; - -export function expandBlocksSuccess(accounts, next) { - return { - type: BLOCKS_EXPAND_SUCCESS, - accounts, - next, - }; -}; - -export function expandBlocksFail(error) { - return { - type: BLOCKS_EXPAND_FAIL, - error, - }; -}; diff --git a/app/javascript/themes/glitch/actions/bundles.js b/app/javascript/themes/glitch/actions/bundles.js deleted file mode 100644 index ecc9c8f7d..000000000 --- a/app/javascript/themes/glitch/actions/bundles.js +++ /dev/null @@ -1,25 +0,0 @@ -export const BUNDLE_FETCH_REQUEST = 'BUNDLE_FETCH_REQUEST'; -export const BUNDLE_FETCH_SUCCESS = 'BUNDLE_FETCH_SUCCESS'; -export const BUNDLE_FETCH_FAIL = 'BUNDLE_FETCH_FAIL'; - -export function fetchBundleRequest(skipLoading) { - return { - type: BUNDLE_FETCH_REQUEST, - skipLoading, - }; -} - -export function fetchBundleSuccess(skipLoading) { - return { - type: BUNDLE_FETCH_SUCCESS, - skipLoading, - }; -} - -export function fetchBundleFail(error, skipLoading) { - return { - type: BUNDLE_FETCH_FAIL, - error, - skipLoading, - }; -} diff --git a/app/javascript/themes/glitch/actions/cards.js b/app/javascript/themes/glitch/actions/cards.js deleted file mode 100644 index 2a1bc369a..000000000 --- a/app/javascript/themes/glitch/actions/cards.js +++ /dev/null @@ -1,52 +0,0 @@ -import api from 'themes/glitch/util/api'; - -export const STATUS_CARD_FETCH_REQUEST = 'STATUS_CARD_FETCH_REQUEST'; -export const STATUS_CARD_FETCH_SUCCESS = 'STATUS_CARD_FETCH_SUCCESS'; -export const STATUS_CARD_FETCH_FAIL = 'STATUS_CARD_FETCH_FAIL'; - -export function fetchStatusCard(id) { - return (dispatch, getState) => { - if (getState().getIn(['cards', id], null) !== null) { - return; - } - - dispatch(fetchStatusCardRequest(id)); - - api(getState).get(`/api/v1/statuses/${id}/card`).then(response => { - if (!response.data.url) { - return; - } - - dispatch(fetchStatusCardSuccess(id, response.data)); - }).catch(error => { - dispatch(fetchStatusCardFail(id, error)); - }); - }; -}; - -export function fetchStatusCardRequest(id) { - return { - type: STATUS_CARD_FETCH_REQUEST, - id, - skipLoading: true, - }; -}; - -export function fetchStatusCardSuccess(id, card) { - return { - type: STATUS_CARD_FETCH_SUCCESS, - id, - card, - skipLoading: true, - }; -}; - -export function fetchStatusCardFail(id, error) { - return { - type: STATUS_CARD_FETCH_FAIL, - id, - error, - skipLoading: true, - skipAlert: true, - }; -}; diff --git a/app/javascript/themes/glitch/actions/columns.js b/app/javascript/themes/glitch/actions/columns.js deleted file mode 100644 index bcb0cdf98..000000000 --- a/app/javascript/themes/glitch/actions/columns.js +++ /dev/null @@ -1,40 +0,0 @@ -import { saveSettings } from './settings'; - -export const COLUMN_ADD = 'COLUMN_ADD'; -export const COLUMN_REMOVE = 'COLUMN_REMOVE'; -export const COLUMN_MOVE = 'COLUMN_MOVE'; - -export function addColumn(id, params) { - return dispatch => { - dispatch({ - type: COLUMN_ADD, - id, - params, - }); - - dispatch(saveSettings()); - }; -}; - -export function removeColumn(uuid) { - return dispatch => { - dispatch({ - type: COLUMN_REMOVE, - uuid, - }); - - dispatch(saveSettings()); - }; -}; - -export function moveColumn(uuid, direction) { - return dispatch => { - dispatch({ - type: COLUMN_MOVE, - uuid, - direction, - }); - - dispatch(saveSettings()); - }; -}; diff --git a/app/javascript/themes/glitch/actions/compose.js b/app/javascript/themes/glitch/actions/compose.js deleted file mode 100644 index 07c469477..000000000 --- a/app/javascript/themes/glitch/actions/compose.js +++ /dev/null @@ -1,398 +0,0 @@ -import api from 'themes/glitch/util/api'; -import { throttle } from 'lodash'; -import { search as emojiSearch } from 'themes/glitch/util/emoji/emoji_mart_search_light'; -import { useEmoji } from './emojis'; - -import { - updateTimeline, - refreshHomeTimeline, - refreshCommunityTimeline, - refreshPublicTimeline, - refreshDirectTimeline, -} from './timelines'; - -export const COMPOSE_CHANGE = 'COMPOSE_CHANGE'; -export const COMPOSE_SUBMIT_REQUEST = 'COMPOSE_SUBMIT_REQUEST'; -export const COMPOSE_SUBMIT_SUCCESS = 'COMPOSE_SUBMIT_SUCCESS'; -export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL'; -export const COMPOSE_REPLY = 'COMPOSE_REPLY'; -export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL'; -export const COMPOSE_MENTION = 'COMPOSE_MENTION'; -export const COMPOSE_RESET = 'COMPOSE_RESET'; -export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST'; -export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS'; -export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL'; -export const COMPOSE_UPLOAD_PROGRESS = 'COMPOSE_UPLOAD_PROGRESS'; -export const COMPOSE_UPLOAD_UNDO = 'COMPOSE_UPLOAD_UNDO'; - -export const COMPOSE_SUGGESTIONS_CLEAR = 'COMPOSE_SUGGESTIONS_CLEAR'; -export const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY'; -export const COMPOSE_SUGGESTION_SELECT = 'COMPOSE_SUGGESTION_SELECT'; - -export const COMPOSE_MOUNT = 'COMPOSE_MOUNT'; -export const COMPOSE_UNMOUNT = 'COMPOSE_UNMOUNT'; - -export const COMPOSE_ADVANCED_OPTIONS_CHANGE = 'COMPOSE_ADVANCED_OPTIONS_CHANGE'; -export const COMPOSE_SENSITIVITY_CHANGE = 'COMPOSE_SENSITIVITY_CHANGE'; -export const COMPOSE_SPOILERNESS_CHANGE = 'COMPOSE_SPOILERNESS_CHANGE'; -export const COMPOSE_SPOILER_TEXT_CHANGE = 'COMPOSE_SPOILER_TEXT_CHANGE'; -export const COMPOSE_VISIBILITY_CHANGE = 'COMPOSE_VISIBILITY_CHANGE'; -export const COMPOSE_LISTABILITY_CHANGE = 'COMPOSE_LISTABILITY_CHANGE'; -export const COMPOSE_COMPOSING_CHANGE = 'COMPOSE_COMPOSING_CHANGE'; - -export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT'; - -export const COMPOSE_UPLOAD_CHANGE_REQUEST = 'COMPOSE_UPLOAD_UPDATE_REQUEST'; -export const COMPOSE_UPLOAD_CHANGE_SUCCESS = 'COMPOSE_UPLOAD_UPDATE_SUCCESS'; -export const COMPOSE_UPLOAD_CHANGE_FAIL = 'COMPOSE_UPLOAD_UPDATE_FAIL'; - -export const COMPOSE_DOODLE_SET = 'COMPOSE_DOODLE_SET'; - -export function changeCompose(text) { - return { - type: COMPOSE_CHANGE, - text: text, - }; -}; - -export function replyCompose(status, router) { - return (dispatch, getState) => { - dispatch({ - type: COMPOSE_REPLY, - status: status, - }); - - if (!getState().getIn(['compose', 'mounted'])) { - router.push('/statuses/new'); - } - }; -}; - -export function cancelReplyCompose() { - return { - type: COMPOSE_REPLY_CANCEL, - }; -}; - -export function resetCompose() { - return { - type: COMPOSE_RESET, - }; -}; - -export function mentionCompose(account, router) { - return (dispatch, getState) => { - dispatch({ - type: COMPOSE_MENTION, - account: account, - }); - - if (!getState().getIn(['compose', 'mounted'])) { - router.push('/statuses/new'); - } - }; -}; - -export function submitCompose() { - return function (dispatch, getState) { - let status = getState().getIn(['compose', 'text'], ''); - - if (!status || !status.length) { - return; - } - - dispatch(submitComposeRequest()); - if (getState().getIn(['compose', 'advanced_options', 'do_not_federate'])) { - status = status + ' 👁️'; - } - api(getState).post('/api/v1/statuses', { - status, - in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null), - media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')), - sensitive: getState().getIn(['compose', 'sensitive']), - spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''), - visibility: getState().getIn(['compose', 'privacy']), - }, { - headers: { - 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), - }, - }).then(function (response) { - dispatch(submitComposeSuccess({ ...response.data })); - - // To make the app more responsive, immediately get the status into the columns - - const insertOrRefresh = (timelineId, refreshAction) => { - if (getState().getIn(['timelines', timelineId, 'online'])) { - dispatch(updateTimeline(timelineId, { ...response.data })); - } else if (getState().getIn(['timelines', timelineId, 'loaded'])) { - dispatch(refreshAction()); - } - }; - - insertOrRefresh('home', refreshHomeTimeline); - - if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { - insertOrRefresh('community', refreshCommunityTimeline); - insertOrRefresh('public', refreshPublicTimeline); - } else if (response.data.visibility === 'direct') { - insertOrRefresh('direct', refreshDirectTimeline); - } - }).catch(function (error) { - dispatch(submitComposeFail(error)); - }); - }; -}; - -export function submitComposeRequest() { - return { - type: COMPOSE_SUBMIT_REQUEST, - }; -}; - -export function submitComposeSuccess(status) { - return { - type: COMPOSE_SUBMIT_SUCCESS, - status: status, - }; -}; - -export function submitComposeFail(error) { - return { - type: COMPOSE_SUBMIT_FAIL, - error: error, - }; -}; - -export function doodleSet(options) { - return { - type: COMPOSE_DOODLE_SET, - options: options, - }; -}; - -export function uploadCompose(files) { - return function (dispatch, getState) { - if (getState().getIn(['compose', 'media_attachments']).size > 3) { - return; - } - - dispatch(uploadComposeRequest()); - - let data = new FormData(); - data.append('file', files[0]); - - api(getState).post('/api/v1/media', data, { - onUploadProgress: function (e) { - dispatch(uploadComposeProgress(e.loaded, e.total)); - }, - }).then(function (response) { - dispatch(uploadComposeSuccess(response.data)); - }).catch(function (error) { - dispatch(uploadComposeFail(error)); - }); - }; -}; - -export function changeUploadCompose(id, description) { - return (dispatch, getState) => { - dispatch(changeUploadComposeRequest()); - - api(getState).put(`/api/v1/media/${id}`, { description }).then(response => { - dispatch(changeUploadComposeSuccess(response.data)); - }).catch(error => { - dispatch(changeUploadComposeFail(id, error)); - }); - }; -}; - -export function changeUploadComposeRequest() { - return { - type: COMPOSE_UPLOAD_CHANGE_REQUEST, - skipLoading: true, - }; -}; -export function changeUploadComposeSuccess(media) { - return { - type: COMPOSE_UPLOAD_CHANGE_SUCCESS, - media: media, - skipLoading: true, - }; -}; - -export function changeUploadComposeFail(error) { - return { - type: COMPOSE_UPLOAD_CHANGE_FAIL, - error: error, - skipLoading: true, - }; -}; - -export function uploadComposeRequest() { - return { - type: COMPOSE_UPLOAD_REQUEST, - skipLoading: true, - }; -}; - -export function uploadComposeProgress(loaded, total) { - return { - type: COMPOSE_UPLOAD_PROGRESS, - loaded: loaded, - total: total, - }; -}; - -export function uploadComposeSuccess(media) { - return { - type: COMPOSE_UPLOAD_SUCCESS, - media: media, - skipLoading: true, - }; -}; - -export function uploadComposeFail(error) { - return { - type: COMPOSE_UPLOAD_FAIL, - error: error, - skipLoading: true, - }; -}; - -export function undoUploadCompose(media_id) { - return { - type: COMPOSE_UPLOAD_UNDO, - media_id: media_id, - }; -}; - -export function clearComposeSuggestions() { - return { - type: COMPOSE_SUGGESTIONS_CLEAR, - }; -}; - -const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) => { - api(getState).get('/api/v1/accounts/search', { - params: { - q: token.slice(1), - resolve: false, - limit: 4, - }, - }).then(response => { - dispatch(readyComposeSuggestionsAccounts(token, response.data)); - }); -}, 200, { leading: true, trailing: true }); - -const fetchComposeSuggestionsEmojis = (dispatch, getState, token) => { - const results = emojiSearch(token.replace(':', ''), { maxResults: 5 }); - dispatch(readyComposeSuggestionsEmojis(token, results)); -}; - -export function fetchComposeSuggestions(token) { - return (dispatch, getState) => { - if (token[0] === ':') { - fetchComposeSuggestionsEmojis(dispatch, getState, token); - } else { - fetchComposeSuggestionsAccounts(dispatch, getState, token); - } - }; -}; - -export function readyComposeSuggestionsEmojis(token, emojis) { - return { - type: COMPOSE_SUGGESTIONS_READY, - token, - emojis, - }; -}; - -export function readyComposeSuggestionsAccounts(token, accounts) { - return { - type: COMPOSE_SUGGESTIONS_READY, - token, - accounts, - }; -}; - -export function selectComposeSuggestion(position, token, suggestion) { - return (dispatch, getState) => { - let completion, startPosition; - - if (typeof suggestion === 'object' && suggestion.id) { - completion = suggestion.native || suggestion.colons; - startPosition = position - 1; - - dispatch(useEmoji(suggestion)); - } else { - completion = getState().getIn(['accounts', suggestion, 'acct']); - startPosition = position; - } - - dispatch({ - type: COMPOSE_SUGGESTION_SELECT, - position: startPosition, - token, - completion, - }); - }; -}; - -export function mountCompose() { - return { - type: COMPOSE_MOUNT, - }; -}; - -export function unmountCompose() { - return { - type: COMPOSE_UNMOUNT, - }; -}; - -export function toggleComposeAdvancedOption(option) { - return { - type: COMPOSE_ADVANCED_OPTIONS_CHANGE, - option: option, - }; -} - -export function changeComposeSensitivity() { - return { - type: COMPOSE_SENSITIVITY_CHANGE, - }; -}; - -export function changeComposeSpoilerness() { - return { - type: COMPOSE_SPOILERNESS_CHANGE, - }; -}; - -export function changeComposeSpoilerText(text) { - return { - type: COMPOSE_SPOILER_TEXT_CHANGE, - text, - }; -}; - -export function changeComposeVisibility(value) { - return { - type: COMPOSE_VISIBILITY_CHANGE, - value, - }; -}; - -export function insertEmojiCompose(position, emoji) { - return { - type: COMPOSE_EMOJI_INSERT, - position, - emoji, - }; -}; - -export function changeComposing(value) { - return { - type: COMPOSE_COMPOSING_CHANGE, - value, - }; -} diff --git a/app/javascript/themes/glitch/actions/domain_blocks.js b/app/javascript/themes/glitch/actions/domain_blocks.js deleted file mode 100644 index 0a880394a..000000000 --- a/app/javascript/themes/glitch/actions/domain_blocks.js +++ /dev/null @@ -1,117 +0,0 @@ -import api, { getLinks } from 'themes/glitch/util/api'; - -export const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST'; -export const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS'; -export const DOMAIN_BLOCK_FAIL = 'DOMAIN_BLOCK_FAIL'; - -export const DOMAIN_UNBLOCK_REQUEST = 'DOMAIN_UNBLOCK_REQUEST'; -export const DOMAIN_UNBLOCK_SUCCESS = 'DOMAIN_UNBLOCK_SUCCESS'; -export const DOMAIN_UNBLOCK_FAIL = 'DOMAIN_UNBLOCK_FAIL'; - -export const DOMAIN_BLOCKS_FETCH_REQUEST = 'DOMAIN_BLOCKS_FETCH_REQUEST'; -export const DOMAIN_BLOCKS_FETCH_SUCCESS = 'DOMAIN_BLOCKS_FETCH_SUCCESS'; -export const DOMAIN_BLOCKS_FETCH_FAIL = 'DOMAIN_BLOCKS_FETCH_FAIL'; - -export function blockDomain(domain, accountId) { - return (dispatch, getState) => { - dispatch(blockDomainRequest(domain)); - - api(getState).post('/api/v1/domain_blocks', { domain }).then(() => { - dispatch(blockDomainSuccess(domain, accountId)); - }).catch(err => { - dispatch(blockDomainFail(domain, err)); - }); - }; -}; - -export function blockDomainRequest(domain) { - return { - type: DOMAIN_BLOCK_REQUEST, - domain, - }; -}; - -export function blockDomainSuccess(domain, accountId) { - return { - type: DOMAIN_BLOCK_SUCCESS, - domain, - accountId, - }; -}; - -export function blockDomainFail(domain, error) { - return { - type: DOMAIN_BLOCK_FAIL, - domain, - error, - }; -}; - -export function unblockDomain(domain, accountId) { - return (dispatch, getState) => { - dispatch(unblockDomainRequest(domain)); - - api(getState).delete('/api/v1/domain_blocks', { params: { domain } }).then(() => { - dispatch(unblockDomainSuccess(domain, accountId)); - }).catch(err => { - dispatch(unblockDomainFail(domain, err)); - }); - }; -}; - -export function unblockDomainRequest(domain) { - return { - type: DOMAIN_UNBLOCK_REQUEST, - domain, - }; -}; - -export function unblockDomainSuccess(domain, accountId) { - return { - type: DOMAIN_UNBLOCK_SUCCESS, - domain, - accountId, - }; -}; - -export function unblockDomainFail(domain, error) { - return { - type: DOMAIN_UNBLOCK_FAIL, - domain, - error, - }; -}; - -export function fetchDomainBlocks() { - return (dispatch, getState) => { - dispatch(fetchDomainBlocksRequest()); - - api(getState).get().then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(fetchDomainBlocksSuccess(response.data, next ? next.uri : null)); - }).catch(err => { - dispatch(fetchDomainBlocksFail(err)); - }); - }; -}; - -export function fetchDomainBlocksRequest() { - return { - type: DOMAIN_BLOCKS_FETCH_REQUEST, - }; -}; - -export function fetchDomainBlocksSuccess(domains, next) { - return { - type: DOMAIN_BLOCKS_FETCH_SUCCESS, - domains, - next, - }; -}; - -export function fetchDomainBlocksFail(error) { - return { - type: DOMAIN_BLOCKS_FETCH_FAIL, - error, - }; -}; diff --git a/app/javascript/themes/glitch/actions/emojis.js b/app/javascript/themes/glitch/actions/emojis.js deleted file mode 100644 index 7cd9d4b7b..000000000 --- a/app/javascript/themes/glitch/actions/emojis.js +++ /dev/null @@ -1,14 +0,0 @@ -import { saveSettings } from './settings'; - -export const EMOJI_USE = 'EMOJI_USE'; - -export function useEmoji(emoji) { - return dispatch => { - dispatch({ - type: EMOJI_USE, - emoji, - }); - - dispatch(saveSettings()); - }; -}; diff --git a/app/javascript/themes/glitch/actions/favourites.js b/app/javascript/themes/glitch/actions/favourites.js deleted file mode 100644 index e9b3559af..000000000 --- a/app/javascript/themes/glitch/actions/favourites.js +++ /dev/null @@ -1,83 +0,0 @@ -import api, { getLinks } from 'themes/glitch/util/api'; - -export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; -export const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS'; -export const FAVOURITED_STATUSES_FETCH_FAIL = 'FAVOURITED_STATUSES_FETCH_FAIL'; - -export const FAVOURITED_STATUSES_EXPAND_REQUEST = 'FAVOURITED_STATUSES_EXPAND_REQUEST'; -export const FAVOURITED_STATUSES_EXPAND_SUCCESS = 'FAVOURITED_STATUSES_EXPAND_SUCCESS'; -export const FAVOURITED_STATUSES_EXPAND_FAIL = 'FAVOURITED_STATUSES_EXPAND_FAIL'; - -export function fetchFavouritedStatuses() { - return (dispatch, getState) => { - dispatch(fetchFavouritedStatusesRequest()); - - api(getState).get('/api/v1/favourites').then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(fetchFavouritedStatusesSuccess(response.data, next ? next.uri : null)); - }).catch(error => { - dispatch(fetchFavouritedStatusesFail(error)); - }); - }; -}; - -export function fetchFavouritedStatusesRequest() { - return { - type: FAVOURITED_STATUSES_FETCH_REQUEST, - }; -}; - -export function fetchFavouritedStatusesSuccess(statuses, next) { - return { - type: FAVOURITED_STATUSES_FETCH_SUCCESS, - statuses, - next, - }; -}; - -export function fetchFavouritedStatusesFail(error) { - return { - type: FAVOURITED_STATUSES_FETCH_FAIL, - error, - }; -}; - -export function expandFavouritedStatuses() { - return (dispatch, getState) => { - const url = getState().getIn(['status_lists', 'favourites', 'next'], null); - - if (url === null) { - return; - } - - dispatch(expandFavouritedStatusesRequest()); - - api(getState).get(url).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(expandFavouritedStatusesSuccess(response.data, next ? next.uri : null)); - }).catch(error => { - dispatch(expandFavouritedStatusesFail(error)); - }); - }; -}; - -export function expandFavouritedStatusesRequest() { - return { - type: FAVOURITED_STATUSES_EXPAND_REQUEST, - }; -}; - -export function expandFavouritedStatusesSuccess(statuses, next) { - return { - type: FAVOURITED_STATUSES_EXPAND_SUCCESS, - statuses, - next, - }; -}; - -export function expandFavouritedStatusesFail(error) { - return { - type: FAVOURITED_STATUSES_EXPAND_FAIL, - error, - }; -}; diff --git a/app/javascript/themes/glitch/actions/height_cache.js b/app/javascript/themes/glitch/actions/height_cache.js deleted file mode 100644 index 4c752993f..000000000 --- a/app/javascript/themes/glitch/actions/height_cache.js +++ /dev/null @@ -1,17 +0,0 @@ -export const HEIGHT_CACHE_SET = 'HEIGHT_CACHE_SET'; -export const HEIGHT_CACHE_CLEAR = 'HEIGHT_CACHE_CLEAR'; - -export function setHeight (key, id, height) { - return { - type: HEIGHT_CACHE_SET, - key, - id, - height, - }; -}; - -export function clearHeight () { - return { - type: HEIGHT_CACHE_CLEAR, - }; -}; diff --git a/app/javascript/themes/glitch/actions/interactions.js b/app/javascript/themes/glitch/actions/interactions.js deleted file mode 100644 index d61a7ba2a..000000000 --- a/app/javascript/themes/glitch/actions/interactions.js +++ /dev/null @@ -1,313 +0,0 @@ -import api from 'themes/glitch/util/api'; - -export const REBLOG_REQUEST = 'REBLOG_REQUEST'; -export const REBLOG_SUCCESS = 'REBLOG_SUCCESS'; -export const REBLOG_FAIL = 'REBLOG_FAIL'; - -export const FAVOURITE_REQUEST = 'FAVOURITE_REQUEST'; -export const FAVOURITE_SUCCESS = 'FAVOURITE_SUCCESS'; -export const FAVOURITE_FAIL = 'FAVOURITE_FAIL'; - -export const UNREBLOG_REQUEST = 'UNREBLOG_REQUEST'; -export const UNREBLOG_SUCCESS = 'UNREBLOG_SUCCESS'; -export const UNREBLOG_FAIL = 'UNREBLOG_FAIL'; - -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 const FAVOURITES_FETCH_REQUEST = 'FAVOURITES_FETCH_REQUEST'; -export const FAVOURITES_FETCH_SUCCESS = 'FAVOURITES_FETCH_SUCCESS'; -export const FAVOURITES_FETCH_FAIL = 'FAVOURITES_FETCH_FAIL'; - -export const PIN_REQUEST = 'PIN_REQUEST'; -export const PIN_SUCCESS = 'PIN_SUCCESS'; -export const PIN_FAIL = 'PIN_FAIL'; - -export const UNPIN_REQUEST = 'UNPIN_REQUEST'; -export const UNPIN_SUCCESS = 'UNPIN_SUCCESS'; -export const UNPIN_FAIL = 'UNPIN_FAIL'; - -export function reblog(status) { - return function (dispatch, getState) { - dispatch(reblogRequest(status)); - - api(getState).post(`/api/v1/statuses/${status.get('id')}/reblog`).then(function (response) { - // The reblog API method returns a new status wrapped around the original. In this case we are only - // interested in how the original is modified, hence passing it skipping the wrapper - dispatch(reblogSuccess(status, response.data.reblog)); - }).catch(function (error) { - dispatch(reblogFail(status, error)); - }); - }; -}; - -export function unreblog(status) { - return (dispatch, getState) => { - dispatch(unreblogRequest(status)); - - api(getState).post(`/api/v1/statuses/${status.get('id')}/unreblog`).then(response => { - dispatch(unreblogSuccess(status, response.data)); - }).catch(error => { - dispatch(unreblogFail(status, error)); - }); - }; -}; - -export function reblogRequest(status) { - return { - type: REBLOG_REQUEST, - status: status, - }; -}; - -export function reblogSuccess(status, response) { - return { - type: REBLOG_SUCCESS, - status: status, - response: response, - }; -}; - -export function reblogFail(status, error) { - return { - type: REBLOG_FAIL, - status: status, - error: error, - }; -}; - -export function unreblogRequest(status) { - return { - type: UNREBLOG_REQUEST, - status: status, - }; -}; - -export function unreblogSuccess(status, response) { - return { - type: UNREBLOG_SUCCESS, - status: status, - response: response, - }; -}; - -export function unreblogFail(status, error) { - return { - type: UNREBLOG_FAIL, - status: status, - error: error, - }; -}; - -export function favourite(status) { - return function (dispatch, getState) { - dispatch(favouriteRequest(status)); - - api(getState).post(`/api/v1/statuses/${status.get('id')}/favourite`).then(function (response) { - dispatch(favouriteSuccess(status, response.data)); - }).catch(function (error) { - dispatch(favouriteFail(status, error)); - }); - }; -}; - -export function unfavourite(status) { - return (dispatch, getState) => { - dispatch(unfavouriteRequest(status)); - - api(getState).post(`/api/v1/statuses/${status.get('id')}/unfavourite`).then(response => { - dispatch(unfavouriteSuccess(status, response.data)); - }).catch(error => { - dispatch(unfavouriteFail(status, error)); - }); - }; -}; - -export function favouriteRequest(status) { - return { - type: FAVOURITE_REQUEST, - status: status, - }; -}; - -export function favouriteSuccess(status, response) { - return { - type: FAVOURITE_SUCCESS, - status: status, - response: response, - }; -}; - -export function favouriteFail(status, error) { - return { - type: FAVOURITE_FAIL, - status: status, - error: error, - }; -}; - -export function unfavouriteRequest(status) { - return { - type: UNFAVOURITE_REQUEST, - status: status, - }; -}; - -export function unfavouriteSuccess(status, response) { - return { - type: UNFAVOURITE_SUCCESS, - status: status, - response: response, - }; -}; - -export function unfavouriteFail(status, error) { - return { - type: UNFAVOURITE_FAIL, - status: status, - 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, - }; -}; - -export function fetchFavourites(id) { - return (dispatch, getState) => { - dispatch(fetchFavouritesRequest(id)); - - api(getState).get(`/api/v1/statuses/${id}/favourited_by`).then(response => { - dispatch(fetchFavouritesSuccess(id, response.data)); - }).catch(error => { - dispatch(fetchFavouritesFail(id, error)); - }); - }; -}; - -export function fetchFavouritesRequest(id) { - return { - type: FAVOURITES_FETCH_REQUEST, - id, - }; -}; - -export function fetchFavouritesSuccess(id, accounts) { - return { - type: FAVOURITES_FETCH_SUCCESS, - id, - accounts, - }; -}; - -export function fetchFavouritesFail(id, error) { - return { - type: FAVOURITES_FETCH_FAIL, - error, - }; -}; - -export function pin(status) { - return (dispatch, getState) => { - dispatch(pinRequest(status)); - - api(getState).post(`/api/v1/statuses/${status.get('id')}/pin`).then(response => { - dispatch(pinSuccess(status, response.data)); - }).catch(error => { - dispatch(pinFail(status, error)); - }); - }; -}; - -export function pinRequest(status) { - return { - type: PIN_REQUEST, - status, - }; -}; - -export function pinSuccess(status, response) { - return { - type: PIN_SUCCESS, - status, - response, - }; -}; - -export function pinFail(status, error) { - return { - type: PIN_FAIL, - status, - error, - }; -}; - -export function unpin (status) { - return (dispatch, getState) => { - dispatch(unpinRequest(status)); - - api(getState).post(`/api/v1/statuses/${status.get('id')}/unpin`).then(response => { - dispatch(unpinSuccess(status, response.data)); - }).catch(error => { - dispatch(unpinFail(status, error)); - }); - }; -}; - -export function unpinRequest(status) { - return { - type: UNPIN_REQUEST, - status, - }; -}; - -export function unpinSuccess(status, response) { - return { - type: UNPIN_SUCCESS, - status, - response, - }; -}; - -export function unpinFail(status, error) { - return { - type: UNPIN_FAIL, - status, - error, - }; -}; diff --git a/app/javascript/themes/glitch/actions/local_settings.js b/app/javascript/themes/glitch/actions/local_settings.js deleted file mode 100644 index 28660a4e8..000000000 --- a/app/javascript/themes/glitch/actions/local_settings.js +++ /dev/null @@ -1,24 +0,0 @@ -export const LOCAL_SETTING_CHANGE = 'LOCAL_SETTING_CHANGE'; - -export function changeLocalSetting(key, value) { - return dispatch => { - dispatch({ - type: LOCAL_SETTING_CHANGE, - key, - value, - }); - - dispatch(saveLocalSettings()); - }; -}; - -// __TODO :__ -// Right now `saveLocalSettings()` doesn't keep track of which user -// is currently signed in, but it might be better to give each user -// their *own* local settings. -export function saveLocalSettings() { - return (_, getState) => { - const localSettings = getState().get('local_settings').toJS(); - localStorage.setItem('mastodon-settings', JSON.stringify(localSettings)); - }; -}; diff --git a/app/javascript/themes/glitch/actions/modal.js b/app/javascript/themes/glitch/actions/modal.js deleted file mode 100644 index 80e15c28e..000000000 --- a/app/javascript/themes/glitch/actions/modal.js +++ /dev/null @@ -1,16 +0,0 @@ -export const MODAL_OPEN = 'MODAL_OPEN'; -export const MODAL_CLOSE = 'MODAL_CLOSE'; - -export function openModal(type, props) { - return { - type: MODAL_OPEN, - modalType: type, - modalProps: props, - }; -}; - -export function closeModal() { - return { - type: MODAL_CLOSE, - }; -}; diff --git a/app/javascript/themes/glitch/actions/mutes.js b/app/javascript/themes/glitch/actions/mutes.js deleted file mode 100644 index bb19e8657..000000000 --- a/app/javascript/themes/glitch/actions/mutes.js +++ /dev/null @@ -1,103 +0,0 @@ -import api, { getLinks } from 'themes/glitch/util/api'; -import { fetchRelationships } from './accounts'; -import { openModal } from 'themes/glitch/actions/modal'; - -export const MUTES_FETCH_REQUEST = 'MUTES_FETCH_REQUEST'; -export const MUTES_FETCH_SUCCESS = 'MUTES_FETCH_SUCCESS'; -export const MUTES_FETCH_FAIL = 'MUTES_FETCH_FAIL'; - -export const MUTES_EXPAND_REQUEST = 'MUTES_EXPAND_REQUEST'; -export const MUTES_EXPAND_SUCCESS = 'MUTES_EXPAND_SUCCESS'; -export const MUTES_EXPAND_FAIL = 'MUTES_EXPAND_FAIL'; - -export const MUTES_INIT_MODAL = 'MUTES_INIT_MODAL'; -export const MUTES_TOGGLE_HIDE_NOTIFICATIONS = 'MUTES_TOGGLE_HIDE_NOTIFICATIONS'; - -export function fetchMutes() { - return (dispatch, getState) => { - dispatch(fetchMutesRequest()); - - api(getState).get('/api/v1/mutes').then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(fetchMutesSuccess(response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => dispatch(fetchMutesFail(error))); - }; -}; - -export function fetchMutesRequest() { - return { - type: MUTES_FETCH_REQUEST, - }; -}; - -export function fetchMutesSuccess(accounts, next) { - return { - type: MUTES_FETCH_SUCCESS, - accounts, - next, - }; -}; - -export function fetchMutesFail(error) { - return { - type: MUTES_FETCH_FAIL, - error, - }; -}; - -export function expandMutes() { - return (dispatch, getState) => { - const url = getState().getIn(['user_lists', 'mutes', 'next']); - - if (url === null) { - return; - } - - dispatch(expandMutesRequest()); - - api(getState).get(url).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(expandMutesSuccess(response.data, next ? next.uri : null)); - dispatch(fetchRelationships(response.data.map(item => item.id))); - }).catch(error => dispatch(expandMutesFail(error))); - }; -}; - -export function expandMutesRequest() { - return { - type: MUTES_EXPAND_REQUEST, - }; -}; - -export function expandMutesSuccess(accounts, next) { - return { - type: MUTES_EXPAND_SUCCESS, - accounts, - next, - }; -}; - -export function expandMutesFail(error) { - return { - type: MUTES_EXPAND_FAIL, - error, - }; -}; - -export function initMuteModal(account) { - return dispatch => { - dispatch({ - type: MUTES_INIT_MODAL, - account, - }); - - dispatch(openModal('MUTE')); - }; -} - -export function toggleHideNotifications() { - return dispatch => { - dispatch({ type: MUTES_TOGGLE_HIDE_NOTIFICATIONS }); - }; -} diff --git a/app/javascript/themes/glitch/actions/notifications.js b/app/javascript/themes/glitch/actions/notifications.js deleted file mode 100644 index fbf06f7c4..000000000 --- a/app/javascript/themes/glitch/actions/notifications.js +++ /dev/null @@ -1,265 +0,0 @@ -import api, { getLinks } from 'themes/glitch/util/api'; -import { List as ImmutableList } from 'immutable'; -import IntlMessageFormat from 'intl-messageformat'; -import { fetchRelationships } from './accounts'; -import { defineMessages } from 'react-intl'; - -export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; - -// tracking the notif cleaning request -export const NOTIFICATIONS_DELETE_MARKED_REQUEST = 'NOTIFICATIONS_DELETE_MARKED_REQUEST'; -export const NOTIFICATIONS_DELETE_MARKED_SUCCESS = 'NOTIFICATIONS_DELETE_MARKED_SUCCESS'; -export const NOTIFICATIONS_DELETE_MARKED_FAIL = 'NOTIFICATIONS_DELETE_MARKED_FAIL'; -export const NOTIFICATIONS_MARK_ALL_FOR_DELETE = 'NOTIFICATIONS_MARK_ALL_FOR_DELETE'; -export const NOTIFICATIONS_ENTER_CLEARING_MODE = 'NOTIFICATIONS_ENTER_CLEARING_MODE'; // arg: yes -// Unmark notifications (when the cleaning mode is left) -export const NOTIFICATIONS_UNMARK_ALL_FOR_DELETE = 'NOTIFICATIONS_UNMARK_ALL_FOR_DELETE'; -// Mark one for delete -export const NOTIFICATION_MARK_FOR_DELETE = 'NOTIFICATION_MARK_FOR_DELETE'; - -export const NOTIFICATIONS_REFRESH_REQUEST = 'NOTIFICATIONS_REFRESH_REQUEST'; -export const NOTIFICATIONS_REFRESH_SUCCESS = 'NOTIFICATIONS_REFRESH_SUCCESS'; -export const NOTIFICATIONS_REFRESH_FAIL = 'NOTIFICATIONS_REFRESH_FAIL'; - -export const NOTIFICATIONS_EXPAND_REQUEST = 'NOTIFICATIONS_EXPAND_REQUEST'; -export const NOTIFICATIONS_EXPAND_SUCCESS = 'NOTIFICATIONS_EXPAND_SUCCESS'; -export const NOTIFICATIONS_EXPAND_FAIL = 'NOTIFICATIONS_EXPAND_FAIL'; - -export const NOTIFICATIONS_CLEAR = 'NOTIFICATIONS_CLEAR'; -export const NOTIFICATIONS_SCROLL_TOP = 'NOTIFICATIONS_SCROLL_TOP'; - -defineMessages({ - mention: { id: 'notification.mention', defaultMessage: '{name} mentioned you' }, -}); - -const fetchRelatedRelationships = (dispatch, notifications) => { - const accountIds = notifications.filter(item => item.type === 'follow').map(item => item.account.id); - - if (accountIds > 0) { - dispatch(fetchRelationships(accountIds)); - } -}; - -const unescapeHTML = (html) => { - const wrapper = document.createElement('div'); - html = html.replace(/
|
|\n/, ' '); - wrapper.innerHTML = html; - return wrapper.textContent; -}; - -export function updateNotifications(notification, intlMessages, intlLocale) { - return (dispatch, getState) => { - const showAlert = getState().getIn(['settings', 'notifications', 'alerts', notification.type], true); - const playSound = getState().getIn(['settings', 'notifications', 'sounds', notification.type], true); - - dispatch({ - type: NOTIFICATIONS_UPDATE, - notification, - account: notification.account, - status: notification.status, - meta: playSound ? { sound: 'boop' } : undefined, - }); - - fetchRelatedRelationships(dispatch, [notification]); - - // Desktop notifications - if (typeof window.Notification !== 'undefined' && showAlert) { - const title = new IntlMessageFormat(intlMessages[`notification.${notification.type}`], intlLocale).format({ name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username }); - const body = (notification.status && notification.status.spoiler_text.length > 0) ? notification.status.spoiler_text : unescapeHTML(notification.status ? notification.status.content : ''); - - const notify = new Notification(title, { body, icon: notification.account.avatar, tag: notification.id }); - notify.addEventListener('click', () => { - window.focus(); - notify.close(); - }); - } - }; -}; - -const excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS(); - -export function refreshNotifications() { - return (dispatch, getState) => { - const params = {}; - const ids = getState().getIn(['notifications', 'items']); - - let skipLoading = false; - - if (ids.size > 0) { - params.since_id = ids.first().get('id'); - } - - if (getState().getIn(['notifications', 'loaded'])) { - skipLoading = true; - } - - params.exclude_types = excludeTypesFromSettings(getState()); - - dispatch(refreshNotificationsRequest(skipLoading)); - - api(getState).get('/api/v1/notifications', { params }).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - - dispatch(refreshNotificationsSuccess(response.data, skipLoading, next ? next.uri : null)); - fetchRelatedRelationships(dispatch, response.data); - }).catch(error => { - dispatch(refreshNotificationsFail(error, skipLoading)); - }); - }; -}; - -export function refreshNotificationsRequest(skipLoading) { - return { - type: NOTIFICATIONS_REFRESH_REQUEST, - skipLoading, - }; -}; - -export function refreshNotificationsSuccess(notifications, skipLoading, next) { - return { - type: NOTIFICATIONS_REFRESH_SUCCESS, - notifications, - accounts: notifications.map(item => item.account), - statuses: notifications.map(item => item.status).filter(status => !!status), - skipLoading, - next, - }; -}; - -export function refreshNotificationsFail(error, skipLoading) { - return { - type: NOTIFICATIONS_REFRESH_FAIL, - error, - skipLoading, - }; -}; - -export function expandNotifications() { - return (dispatch, getState) => { - const items = getState().getIn(['notifications', 'items'], ImmutableList()); - - if (getState().getIn(['notifications', 'isLoading']) || items.size === 0) { - return; - } - - const params = { - max_id: items.last().get('id'), - limit: 20, - exclude_types: excludeTypesFromSettings(getState()), - }; - - dispatch(expandNotificationsRequest()); - - api(getState).get('/api/v1/notifications', { params }).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null)); - fetchRelatedRelationships(dispatch, response.data); - }).catch(error => { - dispatch(expandNotificationsFail(error)); - }); - }; -}; - -export function expandNotificationsRequest() { - return { - type: NOTIFICATIONS_EXPAND_REQUEST, - }; -}; - -export function expandNotificationsSuccess(notifications, next) { - return { - type: NOTIFICATIONS_EXPAND_SUCCESS, - notifications, - accounts: notifications.map(item => item.account), - statuses: notifications.map(item => item.status).filter(status => !!status), - next, - }; -}; - -export function expandNotificationsFail(error) { - return { - type: NOTIFICATIONS_EXPAND_FAIL, - error, - }; -}; - -export function clearNotifications() { - return (dispatch, getState) => { - dispatch({ - type: NOTIFICATIONS_CLEAR, - }); - - api(getState).post('/api/v1/notifications/clear'); - }; -}; - -export function scrollTopNotifications(top) { - return { - type: NOTIFICATIONS_SCROLL_TOP, - top, - }; -}; - -export function deleteMarkedNotifications() { - return (dispatch, getState) => { - dispatch(deleteMarkedNotificationsRequest()); - - let ids = []; - getState().getIn(['notifications', 'items']).forEach((n) => { - if (n.get('markedForDelete')) { - ids.push(n.get('id')); - } - }); - - if (ids.length === 0) { - return; - } - - api(getState).delete(`/api/v1/notifications/destroy_multiple?ids[]=${ids.join('&ids[]=')}`).then(() => { - dispatch(deleteMarkedNotificationsSuccess()); - }).catch(error => { - console.error(error); - dispatch(deleteMarkedNotificationsFail(error)); - }); - }; -}; - -export function enterNotificationClearingMode(yes) { - return { - type: NOTIFICATIONS_ENTER_CLEARING_MODE, - yes: yes, - }; -}; - -export function markAllNotifications(yes) { - return { - type: NOTIFICATIONS_MARK_ALL_FOR_DELETE, - yes: yes, // true, false or null. null = invert - }; -}; - -export function deleteMarkedNotificationsRequest() { - return { - type: NOTIFICATIONS_DELETE_MARKED_REQUEST, - }; -}; - -export function deleteMarkedNotificationsFail() { - return { - type: NOTIFICATIONS_DELETE_MARKED_FAIL, - }; -}; - -export function markNotificationForDelete(id, yes) { - return { - type: NOTIFICATION_MARK_FOR_DELETE, - id: id, - yes: yes, - }; -}; - -export function deleteMarkedNotificationsSuccess() { - return { - type: NOTIFICATIONS_DELETE_MARKED_SUCCESS, - }; -}; diff --git a/app/javascript/themes/glitch/actions/onboarding.js b/app/javascript/themes/glitch/actions/onboarding.js deleted file mode 100644 index a161c50ef..000000000 --- a/app/javascript/themes/glitch/actions/onboarding.js +++ /dev/null @@ -1,14 +0,0 @@ -import { openModal } from './modal'; -import { changeSetting, saveSettings } from './settings'; - -export function showOnboardingOnce() { - return (dispatch, getState) => { - const alreadySeen = getState().getIn(['settings', 'onboarded']); - - if (!alreadySeen) { - dispatch(openModal('ONBOARDING')); - dispatch(changeSetting(['onboarded'], true)); - dispatch(saveSettings()); - } - }; -}; diff --git a/app/javascript/themes/glitch/actions/pin_statuses.js b/app/javascript/themes/glitch/actions/pin_statuses.js deleted file mode 100644 index b3e064e58..000000000 --- a/app/javascript/themes/glitch/actions/pin_statuses.js +++ /dev/null @@ -1,40 +0,0 @@ -import api from 'themes/glitch/util/api'; - -export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST'; -export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; -export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL'; - -import { me } from 'themes/glitch/util/initial_state'; - -export function fetchPinnedStatuses() { - return (dispatch, getState) => { - dispatch(fetchPinnedStatusesRequest()); - - api(getState).get(`/api/v1/accounts/${me}/statuses`, { params: { pinned: true } }).then(response => { - dispatch(fetchPinnedStatusesSuccess(response.data, null)); - }).catch(error => { - dispatch(fetchPinnedStatusesFail(error)); - }); - }; -}; - -export function fetchPinnedStatusesRequest() { - return { - type: PINNED_STATUSES_FETCH_REQUEST, - }; -}; - -export function fetchPinnedStatusesSuccess(statuses, next) { - return { - type: PINNED_STATUSES_FETCH_SUCCESS, - statuses, - next, - }; -}; - -export function fetchPinnedStatusesFail(error) { - return { - type: PINNED_STATUSES_FETCH_FAIL, - error, - }; -}; diff --git a/app/javascript/themes/glitch/actions/push_notifications.js b/app/javascript/themes/glitch/actions/push_notifications.js deleted file mode 100644 index 55661d2b0..000000000 --- a/app/javascript/themes/glitch/actions/push_notifications.js +++ /dev/null @@ -1,52 +0,0 @@ -import axios from 'axios'; - -export const SET_BROWSER_SUPPORT = 'PUSH_NOTIFICATIONS_SET_BROWSER_SUPPORT'; -export const SET_SUBSCRIPTION = 'PUSH_NOTIFICATIONS_SET_SUBSCRIPTION'; -export const CLEAR_SUBSCRIPTION = 'PUSH_NOTIFICATIONS_CLEAR_SUBSCRIPTION'; -export const ALERTS_CHANGE = 'PUSH_NOTIFICATIONS_ALERTS_CHANGE'; - -export function setBrowserSupport (value) { - return { - type: SET_BROWSER_SUPPORT, - value, - }; -} - -export function setSubscription (subscription) { - return { - type: SET_SUBSCRIPTION, - subscription, - }; -} - -export function clearSubscription () { - return { - type: CLEAR_SUBSCRIPTION, - }; -} - -export function changeAlerts(key, value) { - return dispatch => { - dispatch({ - type: ALERTS_CHANGE, - key, - value, - }); - - dispatch(saveSettings()); - }; -} - -export function saveSettings() { - return (_, getState) => { - const state = getState().get('push_notifications'); - const subscription = state.get('subscription'); - const alerts = state.get('alerts'); - - axios.put(`/api/web/push_subscriptions/${subscription.get('id')}`, { - data: { - alerts, - }, - }); - }; -} diff --git a/app/javascript/themes/glitch/actions/reports.js b/app/javascript/themes/glitch/actions/reports.js deleted file mode 100644 index 93f9085b2..000000000 --- a/app/javascript/themes/glitch/actions/reports.js +++ /dev/null @@ -1,80 +0,0 @@ -import api from 'themes/glitch/util/api'; -import { openModal, closeModal } from './modal'; - -export const REPORT_INIT = 'REPORT_INIT'; -export const REPORT_CANCEL = 'REPORT_CANCEL'; - -export const REPORT_SUBMIT_REQUEST = 'REPORT_SUBMIT_REQUEST'; -export const REPORT_SUBMIT_SUCCESS = 'REPORT_SUBMIT_SUCCESS'; -export const REPORT_SUBMIT_FAIL = 'REPORT_SUBMIT_FAIL'; - -export const REPORT_STATUS_TOGGLE = 'REPORT_STATUS_TOGGLE'; -export const REPORT_COMMENT_CHANGE = 'REPORT_COMMENT_CHANGE'; - -export function initReport(account, status) { - return dispatch => { - dispatch({ - type: REPORT_INIT, - account, - status, - }); - - dispatch(openModal('REPORT')); - }; -}; - -export function cancelReport() { - return { - type: REPORT_CANCEL, - }; -}; - -export function toggleStatusReport(statusId, checked) { - return { - type: REPORT_STATUS_TOGGLE, - statusId, - checked, - }; -}; - -export function submitReport() { - return (dispatch, getState) => { - dispatch(submitReportRequest()); - - api(getState).post('/api/v1/reports', { - account_id: getState().getIn(['reports', 'new', 'account_id']), - status_ids: getState().getIn(['reports', 'new', 'status_ids']), - comment: getState().getIn(['reports', 'new', 'comment']), - }).then(response => { - dispatch(closeModal()); - dispatch(submitReportSuccess(response.data)); - }).catch(error => dispatch(submitReportFail(error))); - }; -}; - -export function submitReportRequest() { - return { - type: REPORT_SUBMIT_REQUEST, - }; -}; - -export function submitReportSuccess(report) { - return { - type: REPORT_SUBMIT_SUCCESS, - report, - }; -}; - -export function submitReportFail(error) { - return { - type: REPORT_SUBMIT_FAIL, - error, - }; -}; - -export function changeReportComment(comment) { - return { - type: REPORT_COMMENT_CHANGE, - comment, - }; -}; diff --git a/app/javascript/themes/glitch/actions/search.js b/app/javascript/themes/glitch/actions/search.js deleted file mode 100644 index 414e4755e..000000000 --- a/app/javascript/themes/glitch/actions/search.js +++ /dev/null @@ -1,73 +0,0 @@ -import api from 'themes/glitch/util/api'; - -export const SEARCH_CHANGE = 'SEARCH_CHANGE'; -export const SEARCH_CLEAR = 'SEARCH_CLEAR'; -export const SEARCH_SHOW = 'SEARCH_SHOW'; - -export const SEARCH_FETCH_REQUEST = 'SEARCH_FETCH_REQUEST'; -export const SEARCH_FETCH_SUCCESS = 'SEARCH_FETCH_SUCCESS'; -export const SEARCH_FETCH_FAIL = 'SEARCH_FETCH_FAIL'; - -export function changeSearch(value) { - return { - type: SEARCH_CHANGE, - value, - }; -}; - -export function clearSearch() { - return { - type: SEARCH_CLEAR, - }; -}; - -export function submitSearch() { - return (dispatch, getState) => { - const value = getState().getIn(['search', 'value']); - - if (value.length === 0) { - return; - } - - dispatch(fetchSearchRequest()); - - api(getState).get('/api/v1/search', { - params: { - q: value, - resolve: true, - }, - }).then(response => { - dispatch(fetchSearchSuccess(response.data)); - }).catch(error => { - dispatch(fetchSearchFail(error)); - }); - }; -}; - -export function fetchSearchRequest() { - return { - type: SEARCH_FETCH_REQUEST, - }; -}; - -export function fetchSearchSuccess(results) { - return { - type: SEARCH_FETCH_SUCCESS, - results, - accounts: results.accounts, - statuses: results.statuses, - }; -}; - -export function fetchSearchFail(error) { - return { - type: SEARCH_FETCH_FAIL, - error, - }; -}; - -export function showSearch() { - return { - type: SEARCH_SHOW, - }; -}; diff --git a/app/javascript/themes/glitch/actions/settings.js b/app/javascript/themes/glitch/actions/settings.js deleted file mode 100644 index 79adca18c..000000000 --- a/app/javascript/themes/glitch/actions/settings.js +++ /dev/null @@ -1,31 +0,0 @@ -import axios from 'axios'; -import { debounce } from 'lodash'; - -export const SETTING_CHANGE = 'SETTING_CHANGE'; -export const SETTING_SAVE = 'SETTING_SAVE'; - -export function changeSetting(key, value) { - return dispatch => { - dispatch({ - type: SETTING_CHANGE, - key, - value, - }); - - dispatch(saveSettings()); - }; -}; - -const debouncedSave = debounce((dispatch, getState) => { - if (getState().getIn(['settings', 'saved'])) { - return; - } - - const data = getState().get('settings').filter((_, key) => key !== 'saved').toJS(); - - axios.put('/api/web/settings', { data }).then(() => dispatch({ type: SETTING_SAVE })); -}, 5000, { trailing: true }); - -export function saveSettings() { - return (dispatch, getState) => debouncedSave(dispatch, getState); -}; diff --git a/app/javascript/themes/glitch/actions/statuses.js b/app/javascript/themes/glitch/actions/statuses.js deleted file mode 100644 index 702f4e9b6..000000000 --- a/app/javascript/themes/glitch/actions/statuses.js +++ /dev/null @@ -1,217 +0,0 @@ -import api from 'themes/glitch/util/api'; - -import { deleteFromTimelines } from './timelines'; -import { fetchStatusCard } from './cards'; - -export const STATUS_FETCH_REQUEST = 'STATUS_FETCH_REQUEST'; -export const STATUS_FETCH_SUCCESS = 'STATUS_FETCH_SUCCESS'; -export const STATUS_FETCH_FAIL = 'STATUS_FETCH_FAIL'; - -export const STATUS_DELETE_REQUEST = 'STATUS_DELETE_REQUEST'; -export const STATUS_DELETE_SUCCESS = 'STATUS_DELETE_SUCCESS'; -export const STATUS_DELETE_FAIL = 'STATUS_DELETE_FAIL'; - -export const CONTEXT_FETCH_REQUEST = 'CONTEXT_FETCH_REQUEST'; -export const CONTEXT_FETCH_SUCCESS = 'CONTEXT_FETCH_SUCCESS'; -export const CONTEXT_FETCH_FAIL = 'CONTEXT_FETCH_FAIL'; - -export const STATUS_MUTE_REQUEST = 'STATUS_MUTE_REQUEST'; -export const STATUS_MUTE_SUCCESS = 'STATUS_MUTE_SUCCESS'; -export const STATUS_MUTE_FAIL = 'STATUS_MUTE_FAIL'; - -export const STATUS_UNMUTE_REQUEST = 'STATUS_UNMUTE_REQUEST'; -export const STATUS_UNMUTE_SUCCESS = 'STATUS_UNMUTE_SUCCESS'; -export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL'; - -export function fetchStatusRequest(id, skipLoading) { - return { - type: STATUS_FETCH_REQUEST, - id, - skipLoading, - }; -}; - -export function fetchStatus(id) { - return (dispatch, getState) => { - const skipLoading = getState().getIn(['statuses', id], null) !== null; - - dispatch(fetchContext(id)); - dispatch(fetchStatusCard(id)); - - if (skipLoading) { - return; - } - - dispatch(fetchStatusRequest(id, skipLoading)); - - api(getState).get(`/api/v1/statuses/${id}`).then(response => { - dispatch(fetchStatusSuccess(response.data, skipLoading)); - }).catch(error => { - dispatch(fetchStatusFail(id, error, skipLoading)); - }); - }; -}; - -export function fetchStatusSuccess(status, skipLoading) { - return { - type: STATUS_FETCH_SUCCESS, - status, - skipLoading, - }; -}; - -export function fetchStatusFail(id, error, skipLoading) { - return { - type: STATUS_FETCH_FAIL, - id, - error, - skipLoading, - skipAlert: true, - }; -}; - -export function deleteStatus(id) { - return (dispatch, getState) => { - dispatch(deleteStatusRequest(id)); - - api(getState).delete(`/api/v1/statuses/${id}`).then(() => { - dispatch(deleteStatusSuccess(id)); - dispatch(deleteFromTimelines(id)); - }).catch(error => { - dispatch(deleteStatusFail(id, error)); - }); - }; -}; - -export function deleteStatusRequest(id) { - return { - type: STATUS_DELETE_REQUEST, - id: id, - }; -}; - -export function deleteStatusSuccess(id) { - return { - type: STATUS_DELETE_SUCCESS, - id: id, - }; -}; - -export function deleteStatusFail(id, error) { - return { - type: STATUS_DELETE_FAIL, - id: id, - error: error, - }; -}; - -export function fetchContext(id) { - return (dispatch, getState) => { - dispatch(fetchContextRequest(id)); - - api(getState).get(`/api/v1/statuses/${id}/context`).then(response => { - dispatch(fetchContextSuccess(id, response.data.ancestors, response.data.descendants)); - - }).catch(error => { - if (error.response && error.response.status === 404) { - dispatch(deleteFromTimelines(id)); - } - - dispatch(fetchContextFail(id, error)); - }); - }; -}; - -export function fetchContextRequest(id) { - return { - type: CONTEXT_FETCH_REQUEST, - id, - }; -}; - -export function fetchContextSuccess(id, ancestors, descendants) { - return { - type: CONTEXT_FETCH_SUCCESS, - id, - ancestors, - descendants, - statuses: ancestors.concat(descendants), - }; -}; - -export function fetchContextFail(id, error) { - return { - type: CONTEXT_FETCH_FAIL, - id, - error, - skipAlert: true, - }; -}; - -export function muteStatus(id) { - return (dispatch, getState) => { - dispatch(muteStatusRequest(id)); - - api(getState).post(`/api/v1/statuses/${id}/mute`).then(() => { - dispatch(muteStatusSuccess(id)); - }).catch(error => { - dispatch(muteStatusFail(id, error)); - }); - }; -}; - -export function muteStatusRequest(id) { - return { - type: STATUS_MUTE_REQUEST, - id, - }; -}; - -export function muteStatusSuccess(id) { - return { - type: STATUS_MUTE_SUCCESS, - id, - }; -}; - -export function muteStatusFail(id, error) { - return { - type: STATUS_MUTE_FAIL, - id, - error, - }; -}; - -export function unmuteStatus(id) { - return (dispatch, getState) => { - dispatch(unmuteStatusRequest(id)); - - api(getState).post(`/api/v1/statuses/${id}/unmute`).then(() => { - dispatch(unmuteStatusSuccess(id)); - }).catch(error => { - dispatch(unmuteStatusFail(id, error)); - }); - }; -}; - -export function unmuteStatusRequest(id) { - return { - type: STATUS_UNMUTE_REQUEST, - id, - }; -}; - -export function unmuteStatusSuccess(id) { - return { - type: STATUS_UNMUTE_SUCCESS, - id, - }; -}; - -export function unmuteStatusFail(id, error) { - return { - type: STATUS_UNMUTE_FAIL, - id, - error, - }; -}; diff --git a/app/javascript/themes/glitch/actions/store.js b/app/javascript/themes/glitch/actions/store.js deleted file mode 100644 index a1db0fdd5..000000000 --- a/app/javascript/themes/glitch/actions/store.js +++ /dev/null @@ -1,17 +0,0 @@ -import { Iterable, fromJS } from 'immutable'; - -export const STORE_HYDRATE = 'STORE_HYDRATE'; -export const STORE_HYDRATE_LAZY = 'STORE_HYDRATE_LAZY'; - -const convertState = rawState => - fromJS(rawState, (k, v) => - Iterable.isIndexed(v) ? v.toList() : v.toMap()); - -export function hydrateStore(rawState) { - const state = convertState(rawState); - - return { - type: STORE_HYDRATE, - state, - }; -}; diff --git a/app/javascript/themes/glitch/actions/streaming.js b/app/javascript/themes/glitch/actions/streaming.js deleted file mode 100644 index ccf6c27d8..000000000 --- a/app/javascript/themes/glitch/actions/streaming.js +++ /dev/null @@ -1,54 +0,0 @@ -import { connectStream } from 'themes/glitch/util/stream'; -import { - updateTimeline, - deleteFromTimelines, - refreshHomeTimeline, - connectTimeline, - disconnectTimeline, -} from './timelines'; -import { updateNotifications, refreshNotifications } from './notifications'; -import { getLocale } from 'mastodon/locales'; - -const { messages } = getLocale(); - -export function connectTimelineStream (timelineId, path, pollingRefresh = null) { - - return connectStream (path, pollingRefresh, (dispatch, getState) => { - const locale = getState().getIn(['meta', 'locale']); - return { - onConnect() { - dispatch(connectTimeline(timelineId)); - }, - - onDisconnect() { - dispatch(disconnectTimeline(timelineId)); - }, - - onReceive (data) { - switch(data.event) { - case 'update': - dispatch(updateTimeline(timelineId, JSON.parse(data.payload))); - break; - case 'delete': - dispatch(deleteFromTimelines(data.payload)); - break; - case 'notification': - dispatch(updateNotifications(JSON.parse(data.payload), messages, locale)); - break; - } - }, - }; - }); -} - -function refreshHomeTimelineAndNotification (dispatch) { - dispatch(refreshHomeTimeline()); - dispatch(refreshNotifications()); -} - -export const connectUserStream = () => connectTimelineStream('home', 'user', refreshHomeTimelineAndNotification); -export const connectCommunityStream = () => connectTimelineStream('community', 'public:local'); -export const connectMediaStream = () => connectTimelineStream('community', 'public:local'); -export const connectPublicStream = () => connectTimelineStream('public', 'public'); -export const connectHashtagStream = (tag) => connectTimelineStream(`hashtag:${tag}`, `hashtag&tag=${tag}`); -export const connectDirectStream = () => connectTimelineStream('direct', 'direct'); diff --git a/app/javascript/themes/glitch/actions/timelines.js b/app/javascript/themes/glitch/actions/timelines.js deleted file mode 100644 index 5ce14fbe9..000000000 --- a/app/javascript/themes/glitch/actions/timelines.js +++ /dev/null @@ -1,208 +0,0 @@ -import api, { getLinks } from 'themes/glitch/util/api'; -import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; - -export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; -export const TIMELINE_DELETE = 'TIMELINE_DELETE'; - -export const TIMELINE_REFRESH_REQUEST = 'TIMELINE_REFRESH_REQUEST'; -export const TIMELINE_REFRESH_SUCCESS = 'TIMELINE_REFRESH_SUCCESS'; -export const TIMELINE_REFRESH_FAIL = 'TIMELINE_REFRESH_FAIL'; - -export const TIMELINE_EXPAND_REQUEST = 'TIMELINE_EXPAND_REQUEST'; -export const TIMELINE_EXPAND_SUCCESS = 'TIMELINE_EXPAND_SUCCESS'; -export const TIMELINE_EXPAND_FAIL = 'TIMELINE_EXPAND_FAIL'; - -export const TIMELINE_SCROLL_TOP = 'TIMELINE_SCROLL_TOP'; - -export const TIMELINE_CONNECT = 'TIMELINE_CONNECT'; -export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT'; - -export const TIMELINE_CONTEXT_UPDATE = 'CONTEXT_UPDATE'; - -export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) { - return { - type: TIMELINE_REFRESH_SUCCESS, - timeline, - statuses, - skipLoading, - next, - }; -}; - -export function updateTimeline(timeline, status) { - return (dispatch, getState) => { - const references = status.reblog ? getState().get('statuses').filter((item, itemId) => (itemId === status.reblog.id || item.get('reblog') === status.reblog.id)).map((_, itemId) => itemId) : []; - const parents = []; - - if (status.in_reply_to_id) { - let parent = getState().getIn(['statuses', status.in_reply_to_id]); - - while (parent && parent.get('in_reply_to_id')) { - parents.push(parent.get('id')); - parent = getState().getIn(['statuses', parent.get('in_reply_to_id')]); - } - } - - dispatch({ - type: TIMELINE_UPDATE, - timeline, - status, - references, - }); - - if (parents.length > 0) { - dispatch({ - type: TIMELINE_CONTEXT_UPDATE, - status, - references: parents, - }); - } - }; -}; - -export function deleteFromTimelines(id) { - return (dispatch, getState) => { - const accountId = getState().getIn(['statuses', id, 'account']); - const references = getState().get('statuses').filter(status => status.get('reblog') === id).map(status => [status.get('id'), status.get('account')]); - const reblogOf = getState().getIn(['statuses', id, 'reblog'], null); - - dispatch({ - type: TIMELINE_DELETE, - id, - accountId, - references, - reblogOf, - }); - }; -}; - -export function refreshTimelineRequest(timeline, skipLoading) { - return { - type: TIMELINE_REFRESH_REQUEST, - timeline, - skipLoading, - }; -}; - -export function refreshTimeline(timelineId, path, params = {}) { - return function (dispatch, getState) { - const timeline = getState().getIn(['timelines', timelineId], ImmutableMap()); - - if (timeline.get('isLoading') || timeline.get('online')) { - return; - } - - const ids = timeline.get('items', ImmutableList()); - const newestId = ids.size > 0 ? ids.first() : null; - - let skipLoading = timeline.get('loaded'); - - if (newestId !== null) { - params.since_id = newestId; - } - - dispatch(refreshTimelineRequest(timelineId, skipLoading)); - - api(getState).get(path, { params }).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(refreshTimelineSuccess(timelineId, response.data, skipLoading, next ? next.uri : null)); - }).catch(error => { - dispatch(refreshTimelineFail(timelineId, error, skipLoading)); - }); - }; -}; - -export const refreshHomeTimeline = () => refreshTimeline('home', '/api/v1/timelines/home'); -export const refreshPublicTimeline = () => refreshTimeline('public', '/api/v1/timelines/public'); -export const refreshCommunityTimeline = () => refreshTimeline('community', '/api/v1/timelines/public', { local: true }); -export const refreshDirectTimeline = () => refreshTimeline('direct', '/api/v1/timelines/direct'); -export const refreshAccountTimeline = accountId => refreshTimeline(`account:${accountId}`, `/api/v1/accounts/${accountId}/statuses`); -export const refreshAccountMediaTimeline = accountId => refreshTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { only_media: true }); -export const refreshHashtagTimeline = hashtag => refreshTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`); - -export function refreshTimelineFail(timeline, error, skipLoading) { - return { - type: TIMELINE_REFRESH_FAIL, - timeline, - error, - skipLoading, - skipAlert: error.response && error.response.status === 404, - }; -}; - -export function expandTimeline(timelineId, path, params = {}) { - return (dispatch, getState) => { - const timeline = getState().getIn(['timelines', timelineId], ImmutableMap()); - const ids = timeline.get('items', ImmutableList()); - - if (timeline.get('isLoading') || ids.size === 0) { - return; - } - - params.max_id = ids.last(); - params.limit = 10; - - dispatch(expandTimelineRequest(timelineId)); - - api(getState).get(path, { params }).then(response => { - const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null)); - }).catch(error => { - dispatch(expandTimelineFail(timelineId, error)); - }); - }; -}; - -export const expandHomeTimeline = () => expandTimeline('home', '/api/v1/timelines/home'); -export const expandPublicTimeline = () => expandTimeline('public', '/api/v1/timelines/public'); -export const expandCommunityTimeline = () => expandTimeline('community', '/api/v1/timelines/public', { local: true }); -export const expandDirectTimeline = () => expandTimeline('direct', '/api/v1/timelines/direct'); -export const expandAccountTimeline = accountId => expandTimeline(`account:${accountId}`, `/api/v1/accounts/${accountId}/statuses`); -export const expandAccountMediaTimeline = accountId => expandTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { only_media: true }); -export const expandHashtagTimeline = hashtag => expandTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`); - -export function expandTimelineRequest(timeline) { - return { - type: TIMELINE_EXPAND_REQUEST, - timeline, - }; -}; - -export function expandTimelineSuccess(timeline, statuses, next) { - return { - type: TIMELINE_EXPAND_SUCCESS, - timeline, - statuses, - next, - }; -}; - -export function expandTimelineFail(timeline, error) { - return { - type: TIMELINE_EXPAND_FAIL, - timeline, - error, - }; -}; - -export function scrollTopTimeline(timeline, top) { - return { - type: TIMELINE_SCROLL_TOP, - timeline, - top, - }; -}; - -export function connectTimeline(timeline) { - return { - type: TIMELINE_CONNECT, - timeline, - }; -}; - -export function disconnectTimeline(timeline) { - return { - type: TIMELINE_DISCONNECT, - timeline, - }; -}; -- cgit