Auto select search tab that has results

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2021-08-07 20:57:22 +02:00
commit d36ec10c6a
172 changed files with 747 additions and 699 deletions

View File

@ -1,5 +1,6 @@
/node_modules/** /node_modules/**
/static/** /static/**
/static-test/**
/tmp/** /tmp/**
/coverage/** /coverage/**
!.eslintrc.js !.eslintrc.js

View File

@ -1,6 +1,8 @@
module.exports = { module.exports = {
root: true, root: true,
extends: 'eslint:recommended',
env: { env: {
browser: true, browser: true,
node: true, node: true,
@ -50,7 +52,7 @@ module.exports = {
}, },
rules: { rules: {
'brace-style': 'warn', 'brace-style': 'error',
'comma-dangle': ['error', 'always-multiline'], 'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': [ 'comma-spacing': [
'warn', 'warn',
@ -78,8 +80,11 @@ module.exports = {
], ],
}, },
], ],
'no-extra-semi': 'error',
'no-const-assign': 'error',
'no-fallthrough': 'error', 'no-fallthrough': 'error',
'no-irregular-whitespace': 'error', 'no-irregular-whitespace': 'error',
'no-loop-func': 'error',
'no-mixed-spaces-and-tabs': 'error', 'no-mixed-spaces-and-tabs': 'error',
'no-nested-ternary': 'warn', 'no-nested-ternary': 'warn',
'no-trailing-spaces': 'warn', 'no-trailing-spaces': 'warn',
@ -94,6 +99,8 @@ module.exports = {
ignoreRestSiblings: true, ignoreRestSiblings: true,
}, },
], ],
'no-useless-escape': 'warn',
'no-var': 'error',
'object-curly-spacing': ['error', 'always'], 'object-curly-spacing': ['error', 'always'],
'padded-blocks': [ 'padded-blocks': [
'error', 'error',
@ -101,6 +108,7 @@ module.exports = {
classes: 'always', classes: 'always',
}, },
], ],
'prefer-const': 'error',
quotes: ['error', 'single'], quotes: ['error', 'single'],
semi: 'error', semi: 'error',
strict: 'off', strict: 'off',

View File

@ -125,7 +125,7 @@ export function fetchAccount(id) {
dispatch(fetchAccountFail(id, error)); dispatch(fetchAccountFail(id, error));
}); });
}; };
}; }
export function fetchAccountByUsername(username) { export function fetchAccountByUsername(username) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -145,21 +145,21 @@ export function fetchAccountByUsername(username) {
dispatch(importErrorWhileFetchingAccountByUsername(username)); dispatch(importErrorWhileFetchingAccountByUsername(username));
}); });
}; };
}; }
export function fetchAccountRequest(id) { export function fetchAccountRequest(id) {
return { return {
type: ACCOUNT_FETCH_REQUEST, type: ACCOUNT_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchAccountSuccess(account) { export function fetchAccountSuccess(account) {
return { return {
type: ACCOUNT_FETCH_SUCCESS, type: ACCOUNT_FETCH_SUCCESS,
account, account,
}; };
}; }
export function fetchAccountFail(id, error) { export function fetchAccountFail(id, error) {
return { return {
@ -168,7 +168,7 @@ export function fetchAccountFail(id, error) {
error, error,
skipAlert: true, skipAlert: true,
}; };
}; }
export function followAccount(id, reblogs = true) { export function followAccount(id, reblogs = true) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -185,7 +185,7 @@ export function followAccount(id, reblogs = true) {
dispatch(followAccountFail(error, locked)); dispatch(followAccountFail(error, locked));
}); });
}; };
}; }
export function unfollowAccount(id) { export function unfollowAccount(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -199,7 +199,7 @@ export function unfollowAccount(id) {
dispatch(unfollowAccountFail(error)); dispatch(unfollowAccountFail(error));
}); });
}; };
}; }
export function followAccountRequest(id, locked) { export function followAccountRequest(id, locked) {
return { return {
@ -208,7 +208,7 @@ export function followAccountRequest(id, locked) {
locked, locked,
skipLoading: true, skipLoading: true,
}; };
}; }
export function followAccountSuccess(relationship, alreadyFollowing) { export function followAccountSuccess(relationship, alreadyFollowing) {
return { return {
@ -217,7 +217,7 @@ export function followAccountSuccess(relationship, alreadyFollowing) {
alreadyFollowing, alreadyFollowing,
skipLoading: true, skipLoading: true,
}; };
}; }
export function followAccountFail(error, locked) { export function followAccountFail(error, locked) {
return { return {
@ -226,7 +226,7 @@ export function followAccountFail(error, locked) {
locked, locked,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unfollowAccountRequest(id) { export function unfollowAccountRequest(id) {
return { return {
@ -234,7 +234,7 @@ export function unfollowAccountRequest(id) {
id, id,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unfollowAccountSuccess(relationship, statuses) { export function unfollowAccountSuccess(relationship, statuses) {
return { return {
@ -243,7 +243,7 @@ export function unfollowAccountSuccess(relationship, statuses) {
statuses, statuses,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unfollowAccountFail(error) { export function unfollowAccountFail(error) {
return { return {
@ -251,7 +251,7 @@ export function unfollowAccountFail(error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function blockAccount(id) { export function blockAccount(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -266,7 +266,7 @@ export function blockAccount(id) {
dispatch(blockAccountFail(id, error)); dispatch(blockAccountFail(id, error));
}); });
}; };
}; }
export function unblockAccount(id) { export function unblockAccount(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -280,14 +280,14 @@ export function unblockAccount(id) {
dispatch(unblockAccountFail(id, error)); dispatch(unblockAccountFail(id, error));
}); });
}; };
}; }
export function blockAccountRequest(id) { export function blockAccountRequest(id) {
return { return {
type: ACCOUNT_BLOCK_REQUEST, type: ACCOUNT_BLOCK_REQUEST,
id, id,
}; };
}; }
export function blockAccountSuccess(relationship, statuses) { export function blockAccountSuccess(relationship, statuses) {
return { return {
@ -295,35 +295,35 @@ export function blockAccountSuccess(relationship, statuses) {
relationship, relationship,
statuses, statuses,
}; };
}; }
export function blockAccountFail(error) { export function blockAccountFail(error) {
return { return {
type: ACCOUNT_BLOCK_FAIL, type: ACCOUNT_BLOCK_FAIL,
error, error,
}; };
}; }
export function unblockAccountRequest(id) { export function unblockAccountRequest(id) {
return { return {
type: ACCOUNT_UNBLOCK_REQUEST, type: ACCOUNT_UNBLOCK_REQUEST,
id, id,
}; };
}; }
export function unblockAccountSuccess(relationship) { export function unblockAccountSuccess(relationship) {
return { return {
type: ACCOUNT_UNBLOCK_SUCCESS, type: ACCOUNT_UNBLOCK_SUCCESS,
relationship, relationship,
}; };
}; }
export function unblockAccountFail(error) { export function unblockAccountFail(error) {
return { return {
type: ACCOUNT_UNBLOCK_FAIL, type: ACCOUNT_UNBLOCK_FAIL,
error, error,
}; };
}; }
export function muteAccount(id, notifications) { export function muteAccount(id, notifications) {
@ -339,7 +339,7 @@ export function muteAccount(id, notifications) {
dispatch(muteAccountFail(id, error)); dispatch(muteAccountFail(id, error));
}); });
}; };
}; }
export function unmuteAccount(id) { export function unmuteAccount(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -353,14 +353,14 @@ export function unmuteAccount(id) {
dispatch(unmuteAccountFail(id, error)); dispatch(unmuteAccountFail(id, error));
}); });
}; };
}; }
export function muteAccountRequest(id) { export function muteAccountRequest(id) {
return { return {
type: ACCOUNT_MUTE_REQUEST, type: ACCOUNT_MUTE_REQUEST,
id, id,
}; };
}; }
export function muteAccountSuccess(relationship, statuses) { export function muteAccountSuccess(relationship, statuses) {
return { return {
@ -368,35 +368,35 @@ export function muteAccountSuccess(relationship, statuses) {
relationship, relationship,
statuses, statuses,
}; };
}; }
export function muteAccountFail(error) { export function muteAccountFail(error) {
return { return {
type: ACCOUNT_MUTE_FAIL, type: ACCOUNT_MUTE_FAIL,
error, error,
}; };
}; }
export function unmuteAccountRequest(id) { export function unmuteAccountRequest(id) {
return { return {
type: ACCOUNT_UNMUTE_REQUEST, type: ACCOUNT_UNMUTE_REQUEST,
id, id,
}; };
}; }
export function unmuteAccountSuccess(relationship) { export function unmuteAccountSuccess(relationship) {
return { return {
type: ACCOUNT_UNMUTE_SUCCESS, type: ACCOUNT_UNMUTE_SUCCESS,
relationship, relationship,
}; };
}; }
export function unmuteAccountFail(error) { export function unmuteAccountFail(error) {
return { return {
type: ACCOUNT_UNMUTE_FAIL, type: ACCOUNT_UNMUTE_FAIL,
error, error,
}; };
}; }
export function subscribeAccount(id, notifications) { export function subscribeAccount(id, notifications) {
@ -411,7 +411,7 @@ export function subscribeAccount(id, notifications) {
dispatch(subscribeAccountFail(id, error)); dispatch(subscribeAccountFail(id, error));
}); });
}; };
}; }
export function unsubscribeAccount(id) { export function unsubscribeAccount(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -425,49 +425,49 @@ export function unsubscribeAccount(id) {
dispatch(unsubscribeAccountFail(id, error)); dispatch(unsubscribeAccountFail(id, error));
}); });
}; };
}; }
export function subscribeAccountRequest(id) { export function subscribeAccountRequest(id) {
return { return {
type: ACCOUNT_SUBSCRIBE_REQUEST, type: ACCOUNT_SUBSCRIBE_REQUEST,
id, id,
}; };
}; }
export function subscribeAccountSuccess(relationship) { export function subscribeAccountSuccess(relationship) {
return { return {
type: ACCOUNT_SUBSCRIBE_SUCCESS, type: ACCOUNT_SUBSCRIBE_SUCCESS,
relationship, relationship,
}; };
}; }
export function subscribeAccountFail(error) { export function subscribeAccountFail(error) {
return { return {
type: ACCOUNT_SUBSCRIBE_FAIL, type: ACCOUNT_SUBSCRIBE_FAIL,
error, error,
}; };
}; }
export function unsubscribeAccountRequest(id) { export function unsubscribeAccountRequest(id) {
return { return {
type: ACCOUNT_UNSUBSCRIBE_REQUEST, type: ACCOUNT_UNSUBSCRIBE_REQUEST,
id, id,
}; };
}; }
export function unsubscribeAccountSuccess(relationship) { export function unsubscribeAccountSuccess(relationship) {
return { return {
type: ACCOUNT_UNSUBSCRIBE_SUCCESS, type: ACCOUNT_UNSUBSCRIBE_SUCCESS,
relationship, relationship,
}; };
}; }
export function unsubscribeAccountFail(error) { export function unsubscribeAccountFail(error) {
return { return {
type: ACCOUNT_UNSUBSCRIBE_FAIL, type: ACCOUNT_UNSUBSCRIBE_FAIL,
error, error,
}; };
}; }
export function fetchFollowers(id) { export function fetchFollowers(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -485,14 +485,14 @@ export function fetchFollowers(id) {
dispatch(fetchFollowersFail(id, error)); dispatch(fetchFollowersFail(id, error));
}); });
}; };
}; }
export function fetchFollowersRequest(id) { export function fetchFollowersRequest(id) {
return { return {
type: FOLLOWERS_FETCH_REQUEST, type: FOLLOWERS_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchFollowersSuccess(id, accounts, next) { export function fetchFollowersSuccess(id, accounts, next) {
return { return {
@ -501,7 +501,7 @@ export function fetchFollowersSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function fetchFollowersFail(id, error) { export function fetchFollowersFail(id, error) {
return { return {
@ -509,7 +509,7 @@ export function fetchFollowersFail(id, error) {
id, id,
error, error,
}; };
}; }
export function expandFollowers(id) { export function expandFollowers(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -533,14 +533,14 @@ export function expandFollowers(id) {
dispatch(expandFollowersFail(id, error)); dispatch(expandFollowersFail(id, error));
}); });
}; };
}; }
export function expandFollowersRequest(id) { export function expandFollowersRequest(id) {
return { return {
type: FOLLOWERS_EXPAND_REQUEST, type: FOLLOWERS_EXPAND_REQUEST,
id, id,
}; };
}; }
export function expandFollowersSuccess(id, accounts, next) { export function expandFollowersSuccess(id, accounts, next) {
return { return {
@ -549,7 +549,7 @@ export function expandFollowersSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function expandFollowersFail(id, error) { export function expandFollowersFail(id, error) {
return { return {
@ -557,7 +557,7 @@ export function expandFollowersFail(id, error) {
id, id,
error, error,
}; };
}; }
export function fetchFollowing(id) { export function fetchFollowing(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -575,14 +575,14 @@ export function fetchFollowing(id) {
dispatch(fetchFollowingFail(id, error)); dispatch(fetchFollowingFail(id, error));
}); });
}; };
}; }
export function fetchFollowingRequest(id) { export function fetchFollowingRequest(id) {
return { return {
type: FOLLOWING_FETCH_REQUEST, type: FOLLOWING_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchFollowingSuccess(id, accounts, next) { export function fetchFollowingSuccess(id, accounts, next) {
return { return {
@ -591,7 +591,7 @@ export function fetchFollowingSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function fetchFollowingFail(id, error) { export function fetchFollowingFail(id, error) {
return { return {
@ -599,7 +599,7 @@ export function fetchFollowingFail(id, error) {
id, id,
error, error,
}; };
}; }
export function expandFollowing(id) { export function expandFollowing(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -623,14 +623,14 @@ export function expandFollowing(id) {
dispatch(expandFollowingFail(id, error)); dispatch(expandFollowingFail(id, error));
}); });
}; };
}; }
export function expandFollowingRequest(id) { export function expandFollowingRequest(id) {
return { return {
type: FOLLOWING_EXPAND_REQUEST, type: FOLLOWING_EXPAND_REQUEST,
id, id,
}; };
}; }
export function expandFollowingSuccess(id, accounts, next) { export function expandFollowingSuccess(id, accounts, next) {
return { return {
@ -639,7 +639,7 @@ export function expandFollowingSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function expandFollowingFail(id, error) { export function expandFollowingFail(id, error) {
return { return {
@ -647,7 +647,7 @@ export function expandFollowingFail(id, error) {
id, id,
error, error,
}; };
}; }
export function fetchRelationships(accountIds) { export function fetchRelationships(accountIds) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -668,7 +668,7 @@ export function fetchRelationships(accountIds) {
dispatch(fetchRelationshipsFail(error)); dispatch(fetchRelationshipsFail(error));
}); });
}; };
}; }
export function fetchRelationshipsRequest(ids) { export function fetchRelationshipsRequest(ids) {
return { return {
@ -676,7 +676,7 @@ export function fetchRelationshipsRequest(ids) {
ids, ids,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchRelationshipsSuccess(relationships) { export function fetchRelationshipsSuccess(relationships) {
return { return {
@ -684,7 +684,7 @@ export function fetchRelationshipsSuccess(relationships) {
relationships, relationships,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchRelationshipsFail(error) { export function fetchRelationshipsFail(error) {
return { return {
@ -692,7 +692,7 @@ export function fetchRelationshipsFail(error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchFollowRequests() { export function fetchFollowRequests() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -706,13 +706,13 @@ export function fetchFollowRequests() {
dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null)); dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null));
}).catch(error => dispatch(fetchFollowRequestsFail(error))); }).catch(error => dispatch(fetchFollowRequestsFail(error)));
}; };
}; }
export function fetchFollowRequestsRequest() { export function fetchFollowRequestsRequest() {
return { return {
type: FOLLOW_REQUESTS_FETCH_REQUEST, type: FOLLOW_REQUESTS_FETCH_REQUEST,
}; };
}; }
export function fetchFollowRequestsSuccess(accounts, next) { export function fetchFollowRequestsSuccess(accounts, next) {
return { return {
@ -720,14 +720,14 @@ export function fetchFollowRequestsSuccess(accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function fetchFollowRequestsFail(error) { export function fetchFollowRequestsFail(error) {
return { return {
type: FOLLOW_REQUESTS_FETCH_FAIL, type: FOLLOW_REQUESTS_FETCH_FAIL,
error, error,
}; };
}; }
export function expandFollowRequests() { export function expandFollowRequests() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -747,13 +747,13 @@ export function expandFollowRequests() {
dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null)); dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null));
}).catch(error => dispatch(expandFollowRequestsFail(error))); }).catch(error => dispatch(expandFollowRequestsFail(error)));
}; };
}; }
export function expandFollowRequestsRequest() { export function expandFollowRequestsRequest() {
return { return {
type: FOLLOW_REQUESTS_EXPAND_REQUEST, type: FOLLOW_REQUESTS_EXPAND_REQUEST,
}; };
}; }
export function expandFollowRequestsSuccess(accounts, next) { export function expandFollowRequestsSuccess(accounts, next) {
return { return {
@ -761,14 +761,14 @@ export function expandFollowRequestsSuccess(accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function expandFollowRequestsFail(error) { export function expandFollowRequestsFail(error) {
return { return {
type: FOLLOW_REQUESTS_EXPAND_FAIL, type: FOLLOW_REQUESTS_EXPAND_FAIL,
error, error,
}; };
}; }
export function authorizeFollowRequest(id) { export function authorizeFollowRequest(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -781,21 +781,21 @@ export function authorizeFollowRequest(id) {
.then(() => dispatch(authorizeFollowRequestSuccess(id))) .then(() => dispatch(authorizeFollowRequestSuccess(id)))
.catch(error => dispatch(authorizeFollowRequestFail(id, error))); .catch(error => dispatch(authorizeFollowRequestFail(id, error)));
}; };
}; }
export function authorizeFollowRequestRequest(id) { export function authorizeFollowRequestRequest(id) {
return { return {
type: FOLLOW_REQUEST_AUTHORIZE_REQUEST, type: FOLLOW_REQUEST_AUTHORIZE_REQUEST,
id, id,
}; };
}; }
export function authorizeFollowRequestSuccess(id) { export function authorizeFollowRequestSuccess(id) {
return { return {
type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS, type: FOLLOW_REQUEST_AUTHORIZE_SUCCESS,
id, id,
}; };
}; }
export function authorizeFollowRequestFail(id, error) { export function authorizeFollowRequestFail(id, error) {
return { return {
@ -803,7 +803,7 @@ export function authorizeFollowRequestFail(id, error) {
id, id,
error, error,
}; };
}; }
export function rejectFollowRequest(id) { export function rejectFollowRequest(id) {
@ -817,21 +817,21 @@ export function rejectFollowRequest(id) {
.then(() => dispatch(rejectFollowRequestSuccess(id))) .then(() => dispatch(rejectFollowRequestSuccess(id)))
.catch(error => dispatch(rejectFollowRequestFail(id, error))); .catch(error => dispatch(rejectFollowRequestFail(id, error)));
}; };
}; }
export function rejectFollowRequestRequest(id) { export function rejectFollowRequestRequest(id) {
return { return {
type: FOLLOW_REQUEST_REJECT_REQUEST, type: FOLLOW_REQUEST_REJECT_REQUEST,
id, id,
}; };
}; }
export function rejectFollowRequestSuccess(id) { export function rejectFollowRequestSuccess(id) {
return { return {
type: FOLLOW_REQUEST_REJECT_SUCCESS, type: FOLLOW_REQUEST_REJECT_SUCCESS,
id, id,
}; };
}; }
export function rejectFollowRequestFail(id, error) { export function rejectFollowRequestFail(id, error) {
return { return {
@ -839,7 +839,7 @@ export function rejectFollowRequestFail(id, error) {
id, id,
error, error,
}; };
}; }
export function pinAccount(id) { export function pinAccount(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -853,7 +853,7 @@ export function pinAccount(id) {
dispatch(pinAccountFail(error)); dispatch(pinAccountFail(error));
}); });
}; };
}; }
export function unpinAccount(id) { export function unpinAccount(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -867,7 +867,7 @@ export function unpinAccount(id) {
dispatch(unpinAccountFail(error)); dispatch(unpinAccountFail(error));
}); });
}; };
}; }
export function updateNotificationSettings(params) { export function updateNotificationSettings(params) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -878,46 +878,46 @@ export function updateNotificationSettings(params) {
dispatch({ type: NOTIFICATION_SETTINGS_FAIL, params, error }); dispatch({ type: NOTIFICATION_SETTINGS_FAIL, params, error });
}); });
}; };
}; }
export function pinAccountRequest(id) { export function pinAccountRequest(id) {
return { return {
type: ACCOUNT_PIN_REQUEST, type: ACCOUNT_PIN_REQUEST,
id, id,
}; };
}; }
export function pinAccountSuccess(relationship) { export function pinAccountSuccess(relationship) {
return { return {
type: ACCOUNT_PIN_SUCCESS, type: ACCOUNT_PIN_SUCCESS,
relationship, relationship,
}; };
}; }
export function pinAccountFail(error) { export function pinAccountFail(error) {
return { return {
type: ACCOUNT_PIN_FAIL, type: ACCOUNT_PIN_FAIL,
error, error,
}; };
}; }
export function unpinAccountRequest(id) { export function unpinAccountRequest(id) {
return { return {
type: ACCOUNT_UNPIN_REQUEST, type: ACCOUNT_UNPIN_REQUEST,
id, id,
}; };
}; }
export function unpinAccountSuccess(relationship) { export function unpinAccountSuccess(relationship) {
return { return {
type: ACCOUNT_UNPIN_SUCCESS, type: ACCOUNT_UNPIN_SUCCESS,
relationship, relationship,
}; };
}; }
export function unpinAccountFail(error) { export function unpinAccountFail(error) {
return { return {
type: ACCOUNT_UNPIN_FAIL, type: ACCOUNT_UNPIN_FAIL,
error, error,
}; };
}; }

View File

@ -14,13 +14,13 @@ export function dismissAlert(alert) {
type: ALERT_DISMISS, type: ALERT_DISMISS,
alert, alert,
}; };
}; }
export function clearAlert() { export function clearAlert() {
return { return {
type: ALERT_CLEAR, type: ALERT_CLEAR,
}; };
}; }
export function showAlert(title = messages.unexpectedTitle, message = messages.unexpectedMessage, severity = 'info') { export function showAlert(title = messages.unexpectedTitle, message = messages.unexpectedMessage, severity = 'info') {
return { return {
@ -29,7 +29,7 @@ export function showAlert(title = messages.unexpectedTitle, message = messages.u
message, message,
severity, severity,
}; };
}; }
export function showAlertForError(error) { export function showAlertForError(error) {
if (error.response) { if (error.response) {
@ -45,7 +45,7 @@ export function showAlertForError(error) {
} }
let message = statusText; let message = statusText;
let title = `${status}`; const title = `${status}`;
if (data.error) { if (data.error) {
message = data.error; message = data.error;

View File

@ -26,13 +26,13 @@ export function fetchBlocks() {
dispatch(fetchRelationships(response.data.map(item => item.id))); dispatch(fetchRelationships(response.data.map(item => item.id)));
}).catch(error => dispatch(fetchBlocksFail(error))); }).catch(error => dispatch(fetchBlocksFail(error)));
}; };
}; }
export function fetchBlocksRequest() { export function fetchBlocksRequest() {
return { return {
type: BLOCKS_FETCH_REQUEST, type: BLOCKS_FETCH_REQUEST,
}; };
}; }
export function fetchBlocksSuccess(accounts, next) { export function fetchBlocksSuccess(accounts, next) {
return { return {
@ -40,14 +40,14 @@ export function fetchBlocksSuccess(accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function fetchBlocksFail(error) { export function fetchBlocksFail(error) {
return { return {
type: BLOCKS_FETCH_FAIL, type: BLOCKS_FETCH_FAIL,
error, error,
}; };
}; }
export function expandBlocks() { export function expandBlocks() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -69,13 +69,13 @@ export function expandBlocks() {
dispatch(fetchRelationships(response.data.map(item => item.id))); dispatch(fetchRelationships(response.data.map(item => item.id)));
}).catch(error => dispatch(expandBlocksFail(error))); }).catch(error => dispatch(expandBlocksFail(error)));
}; };
}; }
export function expandBlocksRequest() { export function expandBlocksRequest() {
return { return {
type: BLOCKS_EXPAND_REQUEST, type: BLOCKS_EXPAND_REQUEST,
}; };
}; }
export function expandBlocksSuccess(accounts, next) { export function expandBlocksSuccess(accounts, next) {
return { return {
@ -83,11 +83,11 @@ export function expandBlocksSuccess(accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function expandBlocksFail(error) { export function expandBlocksFail(error) {
return { return {
type: BLOCKS_EXPAND_FAIL, type: BLOCKS_EXPAND_FAIL,
error, error,
}; };
}; }

View File

@ -25,13 +25,13 @@ export function fetchBookmarkedStatuses() {
dispatch(fetchBookmarkedStatusesFail(error)); dispatch(fetchBookmarkedStatusesFail(error));
}); });
}; };
}; }
export function fetchBookmarkedStatusesRequest() { export function fetchBookmarkedStatusesRequest() {
return { return {
type: BOOKMARKED_STATUSES_FETCH_REQUEST, type: BOOKMARKED_STATUSES_FETCH_REQUEST,
}; };
}; }
export function fetchBookmarkedStatusesSuccess(statuses, next) { export function fetchBookmarkedStatusesSuccess(statuses, next) {
return { return {
@ -39,14 +39,14 @@ export function fetchBookmarkedStatusesSuccess(statuses, next) {
statuses, statuses,
next, next,
}; };
}; }
export function fetchBookmarkedStatusesFail(error) { export function fetchBookmarkedStatusesFail(error) {
return { return {
type: BOOKMARKED_STATUSES_FETCH_FAIL, type: BOOKMARKED_STATUSES_FETCH_FAIL,
error, error,
}; };
}; }
export function expandBookmarkedStatuses() { export function expandBookmarkedStatuses() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -66,13 +66,13 @@ export function expandBookmarkedStatuses() {
dispatch(expandBookmarkedStatusesFail(error)); dispatch(expandBookmarkedStatusesFail(error));
}); });
}; };
}; }
export function expandBookmarkedStatusesRequest() { export function expandBookmarkedStatusesRequest() {
return { return {
type: BOOKMARKED_STATUSES_EXPAND_REQUEST, type: BOOKMARKED_STATUSES_EXPAND_REQUEST,
}; };
}; }
export function expandBookmarkedStatusesSuccess(statuses, next) { export function expandBookmarkedStatusesSuccess(statuses, next) {
return { return {
@ -80,11 +80,11 @@ export function expandBookmarkedStatusesSuccess(statuses, next) {
statuses, statuses,
next, next,
}; };
}; }
export function expandBookmarkedStatusesFail(error) { export function expandBookmarkedStatusesFail(error) {
return { return {
type: BOOKMARKED_STATUSES_EXPAND_FAIL, type: BOOKMARKED_STATUSES_EXPAND_FAIL,
error, error,
}; };
}; }

View File

@ -88,7 +88,7 @@ export function changeCompose(text) {
type: COMPOSE_CHANGE, type: COMPOSE_CHANGE,
text: text, text: text,
}; };
}; }
export function replyCompose(status, routerHistory) { export function replyCompose(status, routerHistory) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -101,19 +101,19 @@ export function replyCompose(status, routerHistory) {
dispatch(openModal('COMPOSE')); dispatch(openModal('COMPOSE'));
}; };
}; }
export function cancelReplyCompose() { export function cancelReplyCompose() {
return { return {
type: COMPOSE_REPLY_CANCEL, type: COMPOSE_REPLY_CANCEL,
}; };
}; }
export function resetCompose() { export function resetCompose() {
return { return {
type: COMPOSE_RESET, type: COMPOSE_RESET,
}; };
}; }
export function mentionCompose(account, routerHistory) { export function mentionCompose(account, routerHistory) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -124,7 +124,7 @@ export function mentionCompose(account, routerHistory) {
dispatch(openModal('COMPOSE')); dispatch(openModal('COMPOSE'));
}; };
}; }
export function directCompose(account, routerHistory) { export function directCompose(account, routerHistory) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -135,7 +135,7 @@ export function directCompose(account, routerHistory) {
dispatch(openModal('COMPOSE')); dispatch(openModal('COMPOSE'));
}; };
}; }
export function handleComposeSubmit(dispatch, getState, data, status) { export function handleComposeSubmit(dispatch, getState, data, status) {
if (!dispatch || !getState) return; if (!dispatch || !getState) return;
@ -148,7 +148,7 @@ export function handleComposeSubmit(dispatch, getState, data, status) {
const timeline = getState().getIn(['timelines', timelineId]); const timeline = getState().getIn(['timelines', timelineId]);
if (timeline && timeline.get('items').size > 0 && timeline.getIn(['items', 0]) !== null && timeline.get('online')) { if (timeline && timeline.get('items').size > 0 && timeline.getIn(['items', 0]) !== null && timeline.get('online')) {
let dequeueArgs = {}; const dequeueArgs = {};
if (timelineId === 'community') dequeueArgs.onlyMedia = getSettings(getState()).getIn(['community', 'other', 'onlyMedia']); if (timelineId === 'community') dequeueArgs.onlyMedia = getSettings(getState()).getIn(['community', 'other', 'onlyMedia']);
dispatch(dequeueTimeline(timelineId, null, dequeueArgs)); dispatch(dequeueTimeline(timelineId, null, dequeueArgs));
dispatch(updateTimeline(timelineId, data.id)); dispatch(updateTimeline(timelineId, data.id));
@ -231,27 +231,27 @@ export function submitCompose(routerHistory, force = false) {
dispatch(submitComposeFail(error)); dispatch(submitComposeFail(error));
}); });
}; };
}; }
export function submitComposeRequest() { export function submitComposeRequest() {
return { return {
type: COMPOSE_SUBMIT_REQUEST, type: COMPOSE_SUBMIT_REQUEST,
}; };
}; }
export function submitComposeSuccess(status) { export function submitComposeSuccess(status) {
return { return {
type: COMPOSE_SUBMIT_SUCCESS, type: COMPOSE_SUBMIT_SUCCESS,
status: status, status: status,
}; };
}; }
export function submitComposeFail(error) { export function submitComposeFail(error) {
return { return {
type: COMPOSE_SUBMIT_FAIL, type: COMPOSE_SUBMIT_FAIL,
error: error, error: error,
}; };
}; }
export function uploadCompose(files) { export function uploadCompose(files) {
return function(dispatch, getState) { return function(dispatch, getState) {
@ -272,6 +272,8 @@ export function uploadCompose(files) {
for (const [i, f] of Array.from(files).entries()) { for (const [i, f] of Array.from(files).entries()) {
if (media.size + i > uploadLimit - 1) break; if (media.size + i > uploadLimit - 1) break;
// FIXME: Don't define function in loop
/* eslint-disable no-loop-func */
resizeImage(f).then(file => { resizeImage(f).then(file => {
const data = new FormData(); const data = new FormData();
data.append('file', file); data.append('file', file);
@ -287,9 +289,10 @@ export function uploadCompose(files) {
.then(({ data }) => dispatch(uploadComposeSuccess(data))); .then(({ data }) => dispatch(uploadComposeSuccess(data)));
}).catch(error => dispatch(uploadComposeFail(error))); }).catch(error => dispatch(uploadComposeFail(error)));
}; /* eslint-enable no-loop-func */
}
}; };
}; }
export function changeUploadCompose(id, params) { export function changeUploadCompose(id, params) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -303,21 +306,21 @@ export function changeUploadCompose(id, params) {
dispatch(changeUploadComposeFail(id, error)); dispatch(changeUploadComposeFail(id, error));
}); });
}; };
}; }
export function changeUploadComposeRequest() { export function changeUploadComposeRequest() {
return { return {
type: COMPOSE_UPLOAD_CHANGE_REQUEST, type: COMPOSE_UPLOAD_CHANGE_REQUEST,
skipLoading: true, skipLoading: true,
}; };
}; }
export function changeUploadComposeSuccess(media) { export function changeUploadComposeSuccess(media) {
return { return {
type: COMPOSE_UPLOAD_CHANGE_SUCCESS, type: COMPOSE_UPLOAD_CHANGE_SUCCESS,
media: media, media: media,
skipLoading: true, skipLoading: true,
}; };
}; }
export function changeUploadComposeFail(error) { export function changeUploadComposeFail(error) {
return { return {
@ -325,14 +328,14 @@ export function changeUploadComposeFail(error) {
error: error, error: error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function uploadComposeRequest() { export function uploadComposeRequest() {
return { return {
type: COMPOSE_UPLOAD_REQUEST, type: COMPOSE_UPLOAD_REQUEST,
skipLoading: true, skipLoading: true,
}; };
}; }
export function uploadComposeProgress(loaded, total) { export function uploadComposeProgress(loaded, total) {
return { return {
@ -340,7 +343,7 @@ export function uploadComposeProgress(loaded, total) {
loaded: loaded, loaded: loaded,
total: total, total: total,
}; };
}; }
export function uploadComposeSuccess(media) { export function uploadComposeSuccess(media) {
return { return {
@ -348,7 +351,7 @@ export function uploadComposeSuccess(media) {
media: media, media: media,
skipLoading: true, skipLoading: true,
}; };
}; }
export function uploadComposeFail(error) { export function uploadComposeFail(error) {
return { return {
@ -356,14 +359,14 @@ export function uploadComposeFail(error) {
error: error, error: error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function undoUploadCompose(media_id) { export function undoUploadCompose(media_id) {
return { return {
type: COMPOSE_UPLOAD_UNDO, type: COMPOSE_UPLOAD_UNDO,
media_id: media_id, media_id: media_id,
}; };
}; }
export function clearComposeSuggestions() { export function clearComposeSuggestions() {
if (cancelFetchComposeSuggestionsAccounts) { if (cancelFetchComposeSuggestionsAccounts) {
@ -372,7 +375,7 @@ export function clearComposeSuggestions() {
return { return {
type: COMPOSE_SUGGESTIONS_CLEAR, type: COMPOSE_SUGGESTIONS_CLEAR,
}; };
}; }
const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) => { const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) => {
if (cancelFetchComposeSuggestionsAccounts) { if (cancelFetchComposeSuggestionsAccounts) {
@ -420,7 +423,7 @@ export function fetchComposeSuggestions(token) {
break; break;
} }
}; };
}; }
export function readyComposeSuggestionsEmojis(token, emojis) { export function readyComposeSuggestionsEmojis(token, emojis) {
return { return {
@ -428,7 +431,7 @@ export function readyComposeSuggestionsEmojis(token, emojis) {
token, token,
emojis, emojis,
}; };
}; }
export function readyComposeSuggestionsAccounts(token, accounts) { export function readyComposeSuggestionsAccounts(token, accounts) {
return { return {
@ -436,7 +439,7 @@ export function readyComposeSuggestionsAccounts(token, accounts) {
token, token,
accounts, accounts,
}; };
}; }
export function selectComposeSuggestion(position, token, suggestion, path) { export function selectComposeSuggestion(position, token, suggestion, path) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -463,7 +466,7 @@ export function selectComposeSuggestion(position, token, suggestion, path) {
path, path,
}); });
}; };
}; }
export function updateSuggestionTags(token) { export function updateSuggestionTags(token) {
return { return {
@ -502,46 +505,46 @@ export function mountCompose() {
return { return {
type: COMPOSE_MOUNT, type: COMPOSE_MOUNT,
}; };
}; }
export function unmountCompose() { export function unmountCompose() {
return { return {
type: COMPOSE_UNMOUNT, type: COMPOSE_UNMOUNT,
}; };
}; }
export function changeComposeSensitivity() { export function changeComposeSensitivity() {
return { return {
type: COMPOSE_SENSITIVITY_CHANGE, type: COMPOSE_SENSITIVITY_CHANGE,
}; };
}; }
export function changeComposeSpoilerness() { export function changeComposeSpoilerness() {
return { return {
type: COMPOSE_SPOILERNESS_CHANGE, type: COMPOSE_SPOILERNESS_CHANGE,
}; };
}; }
export function changeComposeContentType(value) { export function changeComposeContentType(value) {
return { return {
type: COMPOSE_TYPE_CHANGE, type: COMPOSE_TYPE_CHANGE,
value, value,
}; };
}; }
export function changeComposeSpoilerText(text) { export function changeComposeSpoilerText(text) {
return { return {
type: COMPOSE_SPOILER_TEXT_CHANGE, type: COMPOSE_SPOILER_TEXT_CHANGE,
text, text,
}; };
}; }
export function changeComposeVisibility(value) { export function changeComposeVisibility(value) {
return { return {
type: COMPOSE_VISIBILITY_CHANGE, type: COMPOSE_VISIBILITY_CHANGE,
value, value,
}; };
}; }
export function insertEmojiCompose(position, emoji, needsSpace) { export function insertEmojiCompose(position, emoji, needsSpace) {
return { return {
@ -550,52 +553,52 @@ export function insertEmojiCompose(position, emoji, needsSpace) {
emoji, emoji,
needsSpace, needsSpace,
}; };
}; }
export function changeComposing(value) { export function changeComposing(value) {
return { return {
type: COMPOSE_COMPOSING_CHANGE, type: COMPOSE_COMPOSING_CHANGE,
value, value,
}; };
}; }
export function addPoll() { export function addPoll() {
return { return {
type: COMPOSE_POLL_ADD, type: COMPOSE_POLL_ADD,
}; };
}; }
export function removePoll() { export function removePoll() {
return { return {
type: COMPOSE_POLL_REMOVE, type: COMPOSE_POLL_REMOVE,
}; };
}; }
export function addSchedule() { export function addSchedule() {
return { return {
type: COMPOSE_SCHEDULE_ADD, type: COMPOSE_SCHEDULE_ADD,
}; };
}; }
export function setSchedule(date) { export function setSchedule(date) {
return { return {
type: COMPOSE_SCHEDULE_SET, type: COMPOSE_SCHEDULE_SET,
date: date, date: date,
}; };
}; }
export function removeSchedule() { export function removeSchedule() {
return { return {
type: COMPOSE_SCHEDULE_REMOVE, type: COMPOSE_SCHEDULE_REMOVE,
}; };
}; }
export function addPollOption(title) { export function addPollOption(title) {
return { return {
type: COMPOSE_POLL_OPTION_ADD, type: COMPOSE_POLL_OPTION_ADD,
title, title,
}; };
}; }
export function changePollOption(index, title) { export function changePollOption(index, title) {
return { return {
@ -603,14 +606,14 @@ export function changePollOption(index, title) {
index, index,
title, title,
}; };
}; }
export function removePollOption(index) { export function removePollOption(index) {
return { return {
type: COMPOSE_POLL_OPTION_REMOVE, type: COMPOSE_POLL_OPTION_REMOVE,
index, index,
}; };
}; }
export function changePollSettings(expiresIn, isMultiple) { export function changePollSettings(expiresIn, isMultiple) {
return { return {
@ -618,4 +621,4 @@ export function changePollSettings(expiresIn, isMultiple) {
expiresIn, expiresIn,
isMultiple, isMultiple,
}; };
}; }

View File

@ -14,14 +14,14 @@ export function fetchCustomEmojis() {
dispatch(fetchCustomEmojisFail(error)); dispatch(fetchCustomEmojisFail(error));
}); });
}; };
}; }
export function fetchCustomEmojisRequest() { export function fetchCustomEmojisRequest() {
return { return {
type: CUSTOM_EMOJIS_FETCH_REQUEST, type: CUSTOM_EMOJIS_FETCH_REQUEST,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchCustomEmojisSuccess(custom_emojis) { export function fetchCustomEmojisSuccess(custom_emojis) {
return { return {
@ -29,7 +29,7 @@ export function fetchCustomEmojisSuccess(custom_emojis) {
custom_emojis, custom_emojis,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchCustomEmojisFail(error) { export function fetchCustomEmojisFail(error) {
return { return {
@ -37,4 +37,4 @@ export function fetchCustomEmojisFail(error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }

View File

@ -31,14 +31,14 @@ export function blockDomain(domain) {
dispatch(blockDomainFail(domain, err)); dispatch(blockDomainFail(domain, err));
}); });
}; };
}; }
export function blockDomainRequest(domain) { export function blockDomainRequest(domain) {
return { return {
type: DOMAIN_BLOCK_REQUEST, type: DOMAIN_BLOCK_REQUEST,
domain, domain,
}; };
}; }
export function blockDomainSuccess(domain, accounts) { export function blockDomainSuccess(domain, accounts) {
return { return {
@ -46,7 +46,7 @@ export function blockDomainSuccess(domain, accounts) {
domain, domain,
accounts, accounts,
}; };
}; }
export function blockDomainFail(domain, error) { export function blockDomainFail(domain, error) {
return { return {
@ -54,7 +54,7 @@ export function blockDomainFail(domain, error) {
domain, domain,
error, error,
}; };
}; }
export function unblockDomain(domain) { export function unblockDomain(domain) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -76,14 +76,14 @@ export function unblockDomain(domain) {
dispatch(unblockDomainFail(domain, err)); dispatch(unblockDomainFail(domain, err));
}); });
}; };
}; }
export function unblockDomainRequest(domain) { export function unblockDomainRequest(domain) {
return { return {
type: DOMAIN_UNBLOCK_REQUEST, type: DOMAIN_UNBLOCK_REQUEST,
domain, domain,
}; };
}; }
export function unblockDomainSuccess(domain, accounts) { export function unblockDomainSuccess(domain, accounts) {
return { return {
@ -91,7 +91,7 @@ export function unblockDomainSuccess(domain, accounts) {
domain, domain,
accounts, accounts,
}; };
}; }
export function unblockDomainFail(domain, error) { export function unblockDomainFail(domain, error) {
return { return {
@ -99,7 +99,7 @@ export function unblockDomainFail(domain, error) {
domain, domain,
error, error,
}; };
}; }
export function fetchDomainBlocks() { export function fetchDomainBlocks() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -114,13 +114,13 @@ export function fetchDomainBlocks() {
dispatch(fetchDomainBlocksFail(err)); dispatch(fetchDomainBlocksFail(err));
}); });
}; };
}; }
export function fetchDomainBlocksRequest() { export function fetchDomainBlocksRequest() {
return { return {
type: DOMAIN_BLOCKS_FETCH_REQUEST, type: DOMAIN_BLOCKS_FETCH_REQUEST,
}; };
}; }
export function fetchDomainBlocksSuccess(domains, next) { export function fetchDomainBlocksSuccess(domains, next) {
return { return {
@ -128,14 +128,14 @@ export function fetchDomainBlocksSuccess(domains, next) {
domains, domains,
next, next,
}; };
}; }
export function fetchDomainBlocksFail(error) { export function fetchDomainBlocksFail(error) {
return { return {
type: DOMAIN_BLOCKS_FETCH_FAIL, type: DOMAIN_BLOCKS_FETCH_FAIL,
error, error,
}; };
}; }
export function expandDomainBlocks() { export function expandDomainBlocks() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -156,13 +156,13 @@ export function expandDomainBlocks() {
dispatch(expandDomainBlocksFail(err)); dispatch(expandDomainBlocksFail(err));
}); });
}; };
}; }
export function expandDomainBlocksRequest() { export function expandDomainBlocksRequest() {
return { return {
type: DOMAIN_BLOCKS_EXPAND_REQUEST, type: DOMAIN_BLOCKS_EXPAND_REQUEST,
}; };
}; }
export function expandDomainBlocksSuccess(domains, next) { export function expandDomainBlocksSuccess(domains, next) {
return { return {
@ -170,11 +170,11 @@ export function expandDomainBlocksSuccess(domains, next) {
domains, domains,
next, next,
}; };
}; }
export function expandDomainBlocksFail(error) { export function expandDomainBlocksFail(error) {
return { return {
type: DOMAIN_BLOCKS_EXPAND_FAIL, type: DOMAIN_BLOCKS_EXPAND_FAIL,
error, error,
}; };
}; }

View File

@ -62,7 +62,7 @@ export function fetchEmojiReacts(id, emoji) {
dispatch(fetchEmojiReactsFail(id, error)); dispatch(fetchEmojiReactsFail(id, error));
}); });
}; };
}; }
export function emojiReact(status, emoji) { export function emojiReact(status, emoji) {
return function(dispatch, getState) { return function(dispatch, getState) {
@ -79,7 +79,7 @@ export function emojiReact(status, emoji) {
dispatch(emojiReactFail(status, emoji, error)); dispatch(emojiReactFail(status, emoji, error));
}); });
}; };
}; }
export function unEmojiReact(status, emoji) { export function unEmojiReact(status, emoji) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -96,7 +96,7 @@ export function unEmojiReact(status, emoji) {
dispatch(unEmojiReactFail(status, emoji, error)); dispatch(unEmojiReactFail(status, emoji, error));
}); });
}; };
}; }
export function fetchEmojiReactsRequest(id, emoji) { export function fetchEmojiReactsRequest(id, emoji) {
return { return {
@ -104,7 +104,7 @@ export function fetchEmojiReactsRequest(id, emoji) {
id, id,
emoji, emoji,
}; };
}; }
export function fetchEmojiReactsSuccess(id, emojiReacts) { export function fetchEmojiReactsSuccess(id, emojiReacts) {
return { return {
@ -112,14 +112,14 @@ export function fetchEmojiReactsSuccess(id, emojiReacts) {
id, id,
emojiReacts, emojiReacts,
}; };
}; }
export function fetchEmojiReactsFail(id, error) { export function fetchEmojiReactsFail(id, error) {
return { return {
type: EMOJI_REACTS_FETCH_FAIL, type: EMOJI_REACTS_FETCH_FAIL,
error, error,
}; };
}; }
export function emojiReactRequest(status, emoji) { export function emojiReactRequest(status, emoji) {
return { return {
@ -128,7 +128,7 @@ export function emojiReactRequest(status, emoji) {
emoji, emoji,
skipLoading: true, skipLoading: true,
}; };
}; }
export function emojiReactSuccess(status, emoji) { export function emojiReactSuccess(status, emoji) {
return { return {
@ -137,7 +137,7 @@ export function emojiReactSuccess(status, emoji) {
emoji, emoji,
skipLoading: true, skipLoading: true,
}; };
}; }
export function emojiReactFail(status, emoji, error) { export function emojiReactFail(status, emoji, error) {
return { return {
@ -147,7 +147,7 @@ export function emojiReactFail(status, emoji, error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unEmojiReactRequest(status, emoji) { export function unEmojiReactRequest(status, emoji) {
return { return {
@ -156,7 +156,7 @@ export function unEmojiReactRequest(status, emoji) {
emoji, emoji,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unEmojiReactSuccess(status, emoji) { export function unEmojiReactSuccess(status, emoji) {
return { return {
@ -165,7 +165,7 @@ export function unEmojiReactSuccess(status, emoji) {
emoji, emoji,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unEmojiReactFail(status, emoji, error) { export function unEmojiReactFail(status, emoji, error) {
return { return {
@ -175,4 +175,4 @@ export function unEmojiReactFail(status, emoji, error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }

View File

@ -11,4 +11,4 @@ export function useEmoji(emoji) {
dispatch(saveSettings()); dispatch(saveSettings());
}; };
}; }

View File

@ -28,14 +28,14 @@ export function fetchFavouritedStatuses() {
dispatch(fetchFavouritedStatusesFail(error)); dispatch(fetchFavouritedStatusesFail(error));
}); });
}; };
}; }
export function fetchFavouritedStatusesRequest() { export function fetchFavouritedStatusesRequest() {
return { return {
type: FAVOURITED_STATUSES_FETCH_REQUEST, type: FAVOURITED_STATUSES_FETCH_REQUEST,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchFavouritedStatusesSuccess(statuses, next) { export function fetchFavouritedStatusesSuccess(statuses, next) {
return { return {
@ -44,7 +44,7 @@ export function fetchFavouritedStatusesSuccess(statuses, next) {
next, next,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchFavouritedStatusesFail(error) { export function fetchFavouritedStatusesFail(error) {
return { return {
@ -52,7 +52,7 @@ export function fetchFavouritedStatusesFail(error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function expandFavouritedStatuses() { export function expandFavouritedStatuses() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -74,13 +74,13 @@ export function expandFavouritedStatuses() {
dispatch(expandFavouritedStatusesFail(error)); dispatch(expandFavouritedStatusesFail(error));
}); });
}; };
}; }
export function expandFavouritedStatusesRequest() { export function expandFavouritedStatusesRequest() {
return { return {
type: FAVOURITED_STATUSES_EXPAND_REQUEST, type: FAVOURITED_STATUSES_EXPAND_REQUEST,
}; };
}; }
export function expandFavouritedStatusesSuccess(statuses, next) { export function expandFavouritedStatusesSuccess(statuses, next) {
return { return {
@ -88,11 +88,11 @@ export function expandFavouritedStatusesSuccess(statuses, next) {
statuses, statuses,
next, next,
}; };
}; }
export function expandFavouritedStatusesFail(error) { export function expandFavouritedStatusesFail(error) {
return { return {
type: FAVOURITED_STATUSES_EXPAND_FAIL, type: FAVOURITED_STATUSES_EXPAND_FAIL,
error, error,
}; };
}; }

View File

@ -102,7 +102,7 @@ export function fetchGroupRelationships(groupIds) {
dispatch(fetchGroupRelationshipsFail(error)); dispatch(fetchGroupRelationshipsFail(error));
}); });
}; };
}; }
export function fetchGroupRelationshipsRequest(ids) { export function fetchGroupRelationshipsRequest(ids) {
return { return {
@ -110,7 +110,7 @@ export function fetchGroupRelationshipsRequest(ids) {
ids, ids,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchGroupRelationshipsSuccess(relationships) { export function fetchGroupRelationshipsSuccess(relationships) {
return { return {
@ -118,7 +118,7 @@ export function fetchGroupRelationshipsSuccess(relationships) {
relationships, relationships,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchGroupRelationshipsFail(error) { export function fetchGroupRelationshipsFail(error) {
return { return {
@ -126,7 +126,7 @@ export function fetchGroupRelationshipsFail(error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }
export const fetchGroups = (tab) => (dispatch, getState) => { export const fetchGroups = (tab) => (dispatch, getState) => {
if (!isLoggedIn(getState)) return; if (!isLoggedIn(getState)) return;
@ -168,7 +168,7 @@ export function joinGroup(id) {
dispatch(joinGroupFail(id, error)); dispatch(joinGroupFail(id, error));
}); });
}; };
}; }
export function leaveGroup(id) { export function leaveGroup(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -182,49 +182,49 @@ export function leaveGroup(id) {
dispatch(leaveGroupFail(id, error)); dispatch(leaveGroupFail(id, error));
}); });
}; };
}; }
export function joinGroupRequest(id) { export function joinGroupRequest(id) {
return { return {
type: GROUP_JOIN_REQUEST, type: GROUP_JOIN_REQUEST,
id, id,
}; };
}; }
export function joinGroupSuccess(relationship) { export function joinGroupSuccess(relationship) {
return { return {
type: GROUP_JOIN_SUCCESS, type: GROUP_JOIN_SUCCESS,
relationship, relationship,
}; };
}; }
export function joinGroupFail(error) { export function joinGroupFail(error) {
return { return {
type: GROUP_JOIN_FAIL, type: GROUP_JOIN_FAIL,
error, error,
}; };
}; }
export function leaveGroupRequest(id) { export function leaveGroupRequest(id) {
return { return {
type: GROUP_LEAVE_REQUEST, type: GROUP_LEAVE_REQUEST,
id, id,
}; };
}; }
export function leaveGroupSuccess(relationship) { export function leaveGroupSuccess(relationship) {
return { return {
type: GROUP_LEAVE_SUCCESS, type: GROUP_LEAVE_SUCCESS,
relationship, relationship,
}; };
}; }
export function leaveGroupFail(error) { export function leaveGroupFail(error) {
return { return {
type: GROUP_LEAVE_FAIL, type: GROUP_LEAVE_FAIL,
error, error,
}; };
}; }
export function fetchMembers(id) { export function fetchMembers(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -242,14 +242,14 @@ export function fetchMembers(id) {
dispatch(fetchMembersFail(id, error)); dispatch(fetchMembersFail(id, error));
}); });
}; };
}; }
export function fetchMembersRequest(id) { export function fetchMembersRequest(id) {
return { return {
type: GROUP_MEMBERS_FETCH_REQUEST, type: GROUP_MEMBERS_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchMembersSuccess(id, accounts, next) { export function fetchMembersSuccess(id, accounts, next) {
return { return {
@ -258,7 +258,7 @@ export function fetchMembersSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function fetchMembersFail(id, error) { export function fetchMembersFail(id, error) {
return { return {
@ -266,7 +266,7 @@ export function fetchMembersFail(id, error) {
id, id,
error, error,
}; };
}; }
export function expandMembers(id) { export function expandMembers(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -290,14 +290,14 @@ export function expandMembers(id) {
dispatch(expandMembersFail(id, error)); dispatch(expandMembersFail(id, error));
}); });
}; };
}; }
export function expandMembersRequest(id) { export function expandMembersRequest(id) {
return { return {
type: GROUP_MEMBERS_EXPAND_REQUEST, type: GROUP_MEMBERS_EXPAND_REQUEST,
id, id,
}; };
}; }
export function expandMembersSuccess(id, accounts, next) { export function expandMembersSuccess(id, accounts, next) {
return { return {
@ -306,7 +306,7 @@ export function expandMembersSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function expandMembersFail(id, error) { export function expandMembersFail(id, error) {
return { return {
@ -314,7 +314,7 @@ export function expandMembersFail(id, error) {
id, id,
error, error,
}; };
}; }
export function fetchRemovedAccounts(id) { export function fetchRemovedAccounts(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -332,14 +332,14 @@ export function fetchRemovedAccounts(id) {
dispatch(fetchRemovedAccountsFail(id, error)); dispatch(fetchRemovedAccountsFail(id, error));
}); });
}; };
}; }
export function fetchRemovedAccountsRequest(id) { export function fetchRemovedAccountsRequest(id) {
return { return {
type: GROUP_REMOVED_ACCOUNTS_FETCH_REQUEST, type: GROUP_REMOVED_ACCOUNTS_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchRemovedAccountsSuccess(id, accounts, next) { export function fetchRemovedAccountsSuccess(id, accounts, next) {
return { return {
@ -348,7 +348,7 @@ export function fetchRemovedAccountsSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function fetchRemovedAccountsFail(id, error) { export function fetchRemovedAccountsFail(id, error) {
return { return {
@ -356,7 +356,7 @@ export function fetchRemovedAccountsFail(id, error) {
id, id,
error, error,
}; };
}; }
export function expandRemovedAccounts(id) { export function expandRemovedAccounts(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -380,14 +380,14 @@ export function expandRemovedAccounts(id) {
dispatch(expandRemovedAccountsFail(id, error)); dispatch(expandRemovedAccountsFail(id, error));
}); });
}; };
}; }
export function expandRemovedAccountsRequest(id) { export function expandRemovedAccountsRequest(id) {
return { return {
type: GROUP_REMOVED_ACCOUNTS_EXPAND_REQUEST, type: GROUP_REMOVED_ACCOUNTS_EXPAND_REQUEST,
id, id,
}; };
}; }
export function expandRemovedAccountsSuccess(id, accounts, next) { export function expandRemovedAccountsSuccess(id, accounts, next) {
return { return {
@ -396,7 +396,7 @@ export function expandRemovedAccountsSuccess(id, accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function expandRemovedAccountsFail(id, error) { export function expandRemovedAccountsFail(id, error) {
return { return {
@ -404,7 +404,7 @@ export function expandRemovedAccountsFail(id, error) {
id, id,
error, error,
}; };
}; }
export function removeRemovedAccount(groupId, id) { export function removeRemovedAccount(groupId, id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -418,7 +418,7 @@ export function removeRemovedAccount(groupId, id) {
dispatch(removeRemovedAccountFail(groupId, id, error)); dispatch(removeRemovedAccountFail(groupId, id, error));
}); });
}; };
}; }
export function removeRemovedAccountRequest(groupId, id) { export function removeRemovedAccountRequest(groupId, id) {
return { return {
@ -426,7 +426,7 @@ export function removeRemovedAccountRequest(groupId, id) {
groupId, groupId,
id, id,
}; };
}; }
export function removeRemovedAccountSuccess(groupId, id) { export function removeRemovedAccountSuccess(groupId, id) {
return { return {
@ -434,7 +434,7 @@ export function removeRemovedAccountSuccess(groupId, id) {
groupId, groupId,
id, id,
}; };
}; }
export function removeRemovedAccountFail(groupId, id, error) { export function removeRemovedAccountFail(groupId, id, error) {
return { return {
@ -443,7 +443,7 @@ export function removeRemovedAccountFail(groupId, id, error) {
id, id,
error, error,
}; };
}; }
export function createRemovedAccount(groupId, id) { export function createRemovedAccount(groupId, id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -457,7 +457,7 @@ export function createRemovedAccount(groupId, id) {
dispatch(createRemovedAccountFail(groupId, id, error)); dispatch(createRemovedAccountFail(groupId, id, error));
}); });
}; };
}; }
export function createRemovedAccountRequest(groupId, id) { export function createRemovedAccountRequest(groupId, id) {
return { return {
@ -465,7 +465,7 @@ export function createRemovedAccountRequest(groupId, id) {
groupId, groupId,
id, id,
}; };
}; }
export function createRemovedAccountSuccess(groupId, id) { export function createRemovedAccountSuccess(groupId, id) {
return { return {
@ -473,7 +473,7 @@ export function createRemovedAccountSuccess(groupId, id) {
groupId, groupId,
id, id,
}; };
}; }
export function createRemovedAccountFail(groupId, id, error) { export function createRemovedAccountFail(groupId, id, error) {
return { return {
@ -482,7 +482,7 @@ export function createRemovedAccountFail(groupId, id, error) {
id, id,
error, error,
}; };
}; }
export function groupRemoveStatus(groupId, id) { export function groupRemoveStatus(groupId, id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -496,7 +496,7 @@ export function groupRemoveStatus(groupId, id) {
dispatch(groupRemoveStatusFail(groupId, id, error)); dispatch(groupRemoveStatusFail(groupId, id, error));
}); });
}; };
}; }
export function groupRemoveStatusRequest(groupId, id) { export function groupRemoveStatusRequest(groupId, id) {
return { return {
@ -504,7 +504,7 @@ export function groupRemoveStatusRequest(groupId, id) {
groupId, groupId,
id, id,
}; };
}; }
export function groupRemoveStatusSuccess(groupId, id) { export function groupRemoveStatusSuccess(groupId, id) {
return { return {
@ -512,7 +512,7 @@ export function groupRemoveStatusSuccess(groupId, id) {
groupId, groupId,
id, id,
}; };
}; }
export function groupRemoveStatusFail(groupId, id, error) { export function groupRemoveStatusFail(groupId, id, error) {
return { return {
@ -521,4 +521,4 @@ export function groupRemoveStatusFail(groupId, id, error) {
id, id,
error, error,
}; };
}; }

View File

@ -8,10 +8,10 @@ export function setHeight(key, id, height) {
id, id,
height, height,
}; };
}; }
export function clearHeight() { export function clearHeight() {
return { return {
type: HEIGHT_CACHE_CLEAR, type: HEIGHT_CACHE_CLEAR,
}; };
}; }

View File

@ -121,4 +121,4 @@ export function importFetchedPoll(poll) {
export function importErrorWhileFetchingAccountByUsername(username) { export function importErrorWhileFetchingAccountByUsername(username) {
return { type: ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP, username }; return { type: ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP, username };
}; }

View File

@ -44,7 +44,7 @@ export function instanceFail(error) {
error, error,
skipAlert: true, skipAlert: true,
}; };
}; }
export function importNodeinfo(nodeinfo) { export function importNodeinfo(nodeinfo) {
return { return {
@ -59,4 +59,4 @@ export function nodeinfoFail(error) {
error, error,
skipAlert: true, skipAlert: true,
}; };
}; }

View File

@ -64,7 +64,7 @@ export function reblog(status) {
dispatch(reblogFail(status, error)); dispatch(reblogFail(status, error));
}); });
}; };
}; }
export function unreblog(status) { export function unreblog(status) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -79,7 +79,7 @@ export function unreblog(status) {
dispatch(unreblogFail(status, error)); dispatch(unreblogFail(status, error));
}); });
}; };
}; }
export function reblogRequest(status) { export function reblogRequest(status) {
return { return {
@ -87,7 +87,7 @@ export function reblogRequest(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function reblogSuccess(status) { export function reblogSuccess(status) {
return { return {
@ -95,7 +95,7 @@ export function reblogSuccess(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function reblogFail(status, error) { export function reblogFail(status, error) {
return { return {
@ -104,7 +104,7 @@ export function reblogFail(status, error) {
error: error, error: error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unreblogRequest(status) { export function unreblogRequest(status) {
return { return {
@ -112,7 +112,7 @@ export function unreblogRequest(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unreblogSuccess(status) { export function unreblogSuccess(status) {
return { return {
@ -120,7 +120,7 @@ export function unreblogSuccess(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unreblogFail(status, error) { export function unreblogFail(status, error) {
return { return {
@ -129,7 +129,7 @@ export function unreblogFail(status, error) {
error: error, error: error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function favourite(status) { export function favourite(status) {
return function(dispatch, getState) { return function(dispatch, getState) {
@ -144,7 +144,7 @@ export function favourite(status) {
dispatch(favouriteFail(status, error)); dispatch(favouriteFail(status, error));
}); });
}; };
}; }
export function unfavourite(status) { export function unfavourite(status) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -159,7 +159,7 @@ export function unfavourite(status) {
dispatch(unfavouriteFail(status, error)); dispatch(unfavouriteFail(status, error));
}); });
}; };
}; }
export function favouriteRequest(status) { export function favouriteRequest(status) {
return { return {
@ -167,7 +167,7 @@ export function favouriteRequest(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function favouriteSuccess(status) { export function favouriteSuccess(status) {
return { return {
@ -175,7 +175,7 @@ export function favouriteSuccess(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function favouriteFail(status, error) { export function favouriteFail(status, error) {
return { return {
@ -184,7 +184,7 @@ export function favouriteFail(status, error) {
error: error, error: error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unfavouriteRequest(status) { export function unfavouriteRequest(status) {
return { return {
@ -192,7 +192,7 @@ export function unfavouriteRequest(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unfavouriteSuccess(status) { export function unfavouriteSuccess(status) {
return { return {
@ -200,7 +200,7 @@ export function unfavouriteSuccess(status) {
status: status, status: status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unfavouriteFail(status, error) { export function unfavouriteFail(status, error) {
return { return {
@ -209,7 +209,7 @@ export function unfavouriteFail(status, error) {
error: error, error: error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function bookmark(intl, status) { export function bookmark(intl, status) {
return function(dispatch, getState) { return function(dispatch, getState) {
@ -223,7 +223,7 @@ export function bookmark(intl, status) {
dispatch(bookmarkFail(status, error)); dispatch(bookmarkFail(status, error));
}); });
}; };
}; }
export function unbookmark(intl, status) { export function unbookmark(intl, status) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -237,14 +237,14 @@ export function unbookmark(intl, status) {
dispatch(unbookmarkFail(status, error)); dispatch(unbookmarkFail(status, error));
}); });
}; };
}; }
export function bookmarkRequest(status) { export function bookmarkRequest(status) {
return { return {
type: BOOKMARK_REQUEST, type: BOOKMARK_REQUEST,
status: status, status: status,
}; };
}; }
export function bookmarkSuccess(status, response) { export function bookmarkSuccess(status, response) {
return { return {
@ -252,7 +252,7 @@ export function bookmarkSuccess(status, response) {
status: status, status: status,
response: response, response: response,
}; };
}; }
export function bookmarkFail(status, error) { export function bookmarkFail(status, error) {
return { return {
@ -260,14 +260,14 @@ export function bookmarkFail(status, error) {
status: status, status: status,
error: error, error: error,
}; };
}; }
export function unbookmarkRequest(status) { export function unbookmarkRequest(status) {
return { return {
type: UNBOOKMARK_REQUEST, type: UNBOOKMARK_REQUEST,
status: status, status: status,
}; };
}; }
export function unbookmarkSuccess(status, response) { export function unbookmarkSuccess(status, response) {
return { return {
@ -275,7 +275,7 @@ export function unbookmarkSuccess(status, response) {
status: status, status: status,
response: response, response: response,
}; };
}; }
export function unbookmarkFail(status, error) { export function unbookmarkFail(status, error) {
return { return {
@ -283,7 +283,7 @@ export function unbookmarkFail(status, error) {
status: status, status: status,
error: error, error: error,
}; };
}; }
export function fetchReblogs(id) { export function fetchReblogs(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -298,14 +298,14 @@ export function fetchReblogs(id) {
dispatch(fetchReblogsFail(id, error)); dispatch(fetchReblogsFail(id, error));
}); });
}; };
}; }
export function fetchReblogsRequest(id) { export function fetchReblogsRequest(id) {
return { return {
type: REBLOGS_FETCH_REQUEST, type: REBLOGS_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchReblogsSuccess(id, accounts) { export function fetchReblogsSuccess(id, accounts) {
return { return {
@ -313,14 +313,14 @@ export function fetchReblogsSuccess(id, accounts) {
id, id,
accounts, accounts,
}; };
}; }
export function fetchReblogsFail(id, error) { export function fetchReblogsFail(id, error) {
return { return {
type: REBLOGS_FETCH_FAIL, type: REBLOGS_FETCH_FAIL,
error, error,
}; };
}; }
export function fetchFavourites(id) { export function fetchFavourites(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -335,14 +335,14 @@ export function fetchFavourites(id) {
dispatch(fetchFavouritesFail(id, error)); dispatch(fetchFavouritesFail(id, error));
}); });
}; };
}; }
export function fetchFavouritesRequest(id) { export function fetchFavouritesRequest(id) {
return { return {
type: FAVOURITES_FETCH_REQUEST, type: FAVOURITES_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchFavouritesSuccess(id, accounts) { export function fetchFavouritesSuccess(id, accounts) {
return { return {
@ -350,14 +350,14 @@ export function fetchFavouritesSuccess(id, accounts) {
id, id,
accounts, accounts,
}; };
}; }
export function fetchFavouritesFail(id, error) { export function fetchFavouritesFail(id, error) {
return { return {
type: FAVOURITES_FETCH_FAIL, type: FAVOURITES_FETCH_FAIL,
error, error,
}; };
}; }
export function pin(status) { export function pin(status) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -372,7 +372,7 @@ export function pin(status) {
dispatch(pinFail(status, error)); dispatch(pinFail(status, error));
}); });
}; };
}; }
export function pinRequest(status) { export function pinRequest(status) {
return { return {
@ -380,7 +380,7 @@ export function pinRequest(status) {
status, status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function pinSuccess(status) { export function pinSuccess(status) {
return { return {
@ -388,7 +388,7 @@ export function pinSuccess(status) {
status, status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function pinFail(status, error) { export function pinFail(status, error) {
return { return {
@ -397,7 +397,7 @@ export function pinFail(status, error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unpin(status) { export function unpin(status) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -412,7 +412,7 @@ export function unpin(status) {
dispatch(unpinFail(status, error)); dispatch(unpinFail(status, error));
}); });
}; };
}; }
export function unpinRequest(status) { export function unpinRequest(status) {
return { return {
@ -420,7 +420,7 @@ export function unpinRequest(status) {
status, status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unpinSuccess(status) { export function unpinSuccess(status) {
return { return {
@ -428,7 +428,7 @@ export function unpinSuccess(status) {
status, status,
skipLoading: true, skipLoading: true,
}; };
}; }
export function unpinFail(status, error) { export function unpinFail(status, error) {
return { return {
@ -437,4 +437,4 @@ export function unpinFail(status, error) {
error, error,
skipLoading: true, skipLoading: true,
}; };
}; }

View File

@ -22,12 +22,12 @@ export function fetchMe() {
if (!token) { if (!token) {
dispatch({ type: ME_FETCH_SKIP }); return noOp(); dispatch({ type: ME_FETCH_SKIP }); return noOp();
}; }
dispatch(fetchMeRequest()); dispatch(fetchMeRequest());
return dispatch(verifyCredentials(token)).catch(error => { return dispatch(verifyCredentials(token)).catch(error => {
dispatch(fetchMeFail(error)); dispatch(fetchMeFail(error));
});; });
}; };
} }
@ -66,7 +66,7 @@ export function fetchMeFail(error) {
error, error,
skipAlert: true, skipAlert: true,
}; };
}; }
export function patchMeRequest() { export function patchMeRequest() {
return { return {
@ -89,4 +89,4 @@ export function patchMeFail(error) {
type: ME_PATCH_FAIL, type: ME_PATCH_FAIL,
error, error,
}; };
}; }

View File

@ -36,19 +36,19 @@ export function fetchUserMfaSettingsRequest() {
return { return {
type: TOTP_SETTINGS_FETCH_REQUEST, type: TOTP_SETTINGS_FETCH_REQUEST,
}; };
}; }
export function fetchUserMfaSettingsSuccess() { export function fetchUserMfaSettingsSuccess() {
return { return {
type: TOTP_SETTINGS_FETCH_SUCCESS, type: TOTP_SETTINGS_FETCH_SUCCESS,
}; };
}; }
export function fetchUserMfaSettingsFail() { export function fetchUserMfaSettingsFail() {
return { return {
type: TOTP_SETTINGS_FETCH_FAIL, type: TOTP_SETTINGS_FETCH_FAIL,
}; };
}; }
export function fetchBackupCodes() { export function fetchBackupCodes() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -66,21 +66,21 @@ export function fetchBackupCodesRequest() {
return { return {
type: BACKUP_CODES_FETCH_REQUEST, type: BACKUP_CODES_FETCH_REQUEST,
}; };
}; }
export function fetchBackupCodesSuccess(backup_codes, response) { export function fetchBackupCodesSuccess(backup_codes, response) {
return { return {
type: BACKUP_CODES_FETCH_SUCCESS, type: BACKUP_CODES_FETCH_SUCCESS,
backup_codes: response.data, backup_codes: response.data,
}; };
}; }
export function fetchBackupCodesFail(error) { export function fetchBackupCodesFail(error) {
return { return {
type: BACKUP_CODES_FETCH_FAIL, type: BACKUP_CODES_FETCH_FAIL,
error, error,
}; };
}; }
export function fetchToptSetup() { export function fetchToptSetup() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -98,21 +98,21 @@ export function fetchToptSetupRequest() {
return { return {
type: TOTP_SETUP_FETCH_REQUEST, type: TOTP_SETUP_FETCH_REQUEST,
}; };
}; }
export function fetchToptSetupSuccess(totp_setup, response) { export function fetchToptSetupSuccess(totp_setup, response) {
return { return {
type: TOTP_SETUP_FETCH_SUCCESS, type: TOTP_SETUP_FETCH_SUCCESS,
totp_setup: response.data, totp_setup: response.data,
}; };
}; }
export function fetchToptSetupFail(error) { export function fetchToptSetupFail(error) {
return { return {
type: TOTP_SETUP_FETCH_FAIL, type: TOTP_SETUP_FETCH_FAIL,
error, error,
}; };
}; }
export function confirmToptSetup(code, password) { export function confirmToptSetup(code, password) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -133,20 +133,20 @@ export function confirmToptRequest() {
return { return {
type: CONFIRM_TOTP_REQUEST, type: CONFIRM_TOTP_REQUEST,
}; };
}; }
export function confirmToptSuccess(backup_codes, response) { export function confirmToptSuccess(backup_codes, response) {
return { return {
type: CONFIRM_TOTP_SUCCESS, type: CONFIRM_TOTP_SUCCESS,
}; };
}; }
export function confirmToptFail(error) { export function confirmToptFail(error) {
return { return {
type: CONFIRM_TOTP_FAIL, type: CONFIRM_TOTP_FAIL,
error, error,
}; };
}; }
export function disableToptSetup(password) { export function disableToptSetup(password) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -164,17 +164,17 @@ export function disableToptRequest() {
return { return {
type: DISABLE_TOTP_REQUEST, type: DISABLE_TOTP_REQUEST,
}; };
}; }
export function disableToptSuccess(backup_codes, response) { export function disableToptSuccess(backup_codes, response) {
return { return {
type: DISABLE_TOTP_SUCCESS, type: DISABLE_TOTP_SUCCESS,
}; };
}; }
export function disableToptFail(error) { export function disableToptFail(error) {
return { return {
type: DISABLE_TOTP_FAIL, type: DISABLE_TOTP_FAIL,
error, error,
}; };
}; }

View File

@ -7,10 +7,10 @@ export function openModal(type, props) {
modalType: type, modalType: type,
modalProps: props, modalProps: props,
}; };
}; }
export function closeModal() { export function closeModal() {
return { return {
type: MODAL_CLOSE, type: MODAL_CLOSE,
}; };
}; }

View File

@ -30,13 +30,13 @@ export function fetchMutes() {
dispatch(fetchRelationships(response.data.map(item => item.id))); dispatch(fetchRelationships(response.data.map(item => item.id)));
}).catch(error => dispatch(fetchMutesFail(error))); }).catch(error => dispatch(fetchMutesFail(error)));
}; };
}; }
export function fetchMutesRequest() { export function fetchMutesRequest() {
return { return {
type: MUTES_FETCH_REQUEST, type: MUTES_FETCH_REQUEST,
}; };
}; }
export function fetchMutesSuccess(accounts, next) { export function fetchMutesSuccess(accounts, next) {
return { return {
@ -44,14 +44,14 @@ export function fetchMutesSuccess(accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function fetchMutesFail(error) { export function fetchMutesFail(error) {
return { return {
type: MUTES_FETCH_FAIL, type: MUTES_FETCH_FAIL,
error, error,
}; };
}; }
export function expandMutes() { export function expandMutes() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -73,13 +73,13 @@ export function expandMutes() {
dispatch(fetchRelationships(response.data.map(item => item.id))); dispatch(fetchRelationships(response.data.map(item => item.id)));
}).catch(error => dispatch(expandMutesFail(error))); }).catch(error => dispatch(expandMutesFail(error)));
}; };
}; }
export function expandMutesRequest() { export function expandMutesRequest() {
return { return {
type: MUTES_EXPAND_REQUEST, type: MUTES_EXPAND_REQUEST,
}; };
}; }
export function expandMutesSuccess(accounts, next) { export function expandMutesSuccess(accounts, next) {
return { return {
@ -87,14 +87,14 @@ export function expandMutesSuccess(accounts, next) {
accounts, accounts,
next, next,
}; };
}; }
export function expandMutesFail(error) { export function expandMutesFail(error) {
return { return {
type: MUTES_EXPAND_FAIL, type: MUTES_EXPAND_FAIL,
error, error,
}; };
}; }
export function initMuteModal(account) { export function initMuteModal(account) {
return dispatch => { return dispatch => {

View File

@ -78,7 +78,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) {
fetchRelatedRelationships(dispatch, [notification]); fetchRelatedRelationships(dispatch, [notification]);
} }
}; };
}; }
export function updateNotificationsQueue(notification, intlMessages, intlLocale, curPath) { export function updateNotificationsQueue(notification, intlMessages, intlLocale, curPath) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -133,7 +133,7 @@ export function updateNotificationsQueue(notification, intlMessages, intlLocale,
dispatch(updateNotifications(notification, intlMessages, intlLocale)); dispatch(updateNotifications(notification, intlMessages, intlLocale));
} }
}; };
}; }
export function dequeueNotifications() { export function dequeueNotifications() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -155,7 +155,7 @@ export function dequeueNotifications() {
}); });
dispatch(markReadNotifications()); dispatch(markReadNotifications());
}; };
}; }
const excludeTypesFromSettings = getState => getSettings(getState()).getIn(['notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS(); const excludeTypesFromSettings = getState => getSettings(getState()).getIn(['notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
@ -223,14 +223,14 @@ export function expandNotifications({ maxId } = {}, done = noOp) {
done(); done();
}); });
}; };
}; }
export function expandNotificationsRequest(isLoadingMore) { export function expandNotificationsRequest(isLoadingMore) {
return { return {
type: NOTIFICATIONS_EXPAND_REQUEST, type: NOTIFICATIONS_EXPAND_REQUEST,
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}; };
}; }
export function expandNotificationsSuccess(notifications, next, isLoadingMore) { export function expandNotificationsSuccess(notifications, next, isLoadingMore) {
return { return {
@ -239,7 +239,7 @@ export function expandNotificationsSuccess(notifications, next, isLoadingMore) {
next, next,
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}; };
}; }
export function expandNotificationsFail(error, isLoadingMore) { export function expandNotificationsFail(error, isLoadingMore) {
return { return {
@ -247,7 +247,7 @@ export function expandNotificationsFail(error, isLoadingMore) {
error, error,
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}; };
}; }
export function clearNotifications() { export function clearNotifications() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -259,7 +259,7 @@ export function clearNotifications() {
api(getState).post('/api/v1/notifications/clear'); api(getState).post('/api/v1/notifications/clear');
}; };
}; }
export function scrollTopNotifications(top) { export function scrollTopNotifications(top) {
return (dispatch, getState) => { return (dispatch, getState) => {

View File

@ -17,7 +17,7 @@ export function fetchPatronInstance() {
dispatch(fetchInstanceFail(error)); dispatch(fetchInstanceFail(error));
}); });
}; };
}; }
export function fetchPatronAccount(apId) { export function fetchPatronAccount(apId) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -44,7 +44,7 @@ function fetchInstanceFail(error) {
error, error,
skipAlert: true, skipAlert: true,
}; };
}; }
function importFetchedAccount(account) { function importFetchedAccount(account) {
return { return {

View File

@ -20,13 +20,13 @@ export function fetchPinnedStatuses() {
dispatch(fetchPinnedStatusesFail(error)); dispatch(fetchPinnedStatusesFail(error));
}); });
}; };
}; }
export function fetchPinnedStatusesRequest() { export function fetchPinnedStatusesRequest() {
return { return {
type: PINNED_STATUSES_FETCH_REQUEST, type: PINNED_STATUSES_FETCH_REQUEST,
}; };
}; }
export function fetchPinnedStatusesSuccess(statuses, next) { export function fetchPinnedStatusesSuccess(statuses, next) {
return { return {
@ -34,11 +34,11 @@ export function fetchPinnedStatusesSuccess(statuses, next) {
statuses, statuses,
next, next,
}; };
}; }
export function fetchPinnedStatusesFail(error) { export function fetchPinnedStatusesFail(error) {
return { return {
type: PINNED_STATUSES_FETCH_FAIL, type: PINNED_STATUSES_FETCH_FAIL,
error, error,
}; };
}; }

View File

@ -23,7 +23,7 @@ export function initReport(account, status) {
dispatch(openModal('REPORT')); dispatch(openModal('REPORT'));
}; };
}; }
export function initReportById(accountId) { export function initReportById(accountId) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -34,13 +34,13 @@ export function initReportById(accountId) {
dispatch(openModal('REPORT')); dispatch(openModal('REPORT'));
}; };
}; }
export function cancelReport() { export function cancelReport() {
return { return {
type: REPORT_CANCEL, type: REPORT_CANCEL,
}; };
}; }
export function toggleStatusReport(statusId, checked) { export function toggleStatusReport(statusId, checked) {
return { return {
@ -48,7 +48,7 @@ export function toggleStatusReport(statusId, checked) {
statusId, statusId,
checked, checked,
}; };
}; }
export function submitReport() { export function submitReport() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -64,45 +64,45 @@ export function submitReport() {
dispatch(submitReportSuccess(response.data)); dispatch(submitReportSuccess(response.data));
}).catch(error => dispatch(submitReportFail(error))); }).catch(error => dispatch(submitReportFail(error)));
}; };
}; }
export function submitReportRequest() { export function submitReportRequest() {
return { return {
type: REPORT_SUBMIT_REQUEST, type: REPORT_SUBMIT_REQUEST,
}; };
}; }
export function submitReportSuccess(report) { export function submitReportSuccess(report) {
return { return {
type: REPORT_SUBMIT_SUCCESS, type: REPORT_SUBMIT_SUCCESS,
report, report,
}; };
}; }
export function submitReportFail(error) { export function submitReportFail(error) {
return { return {
type: REPORT_SUBMIT_FAIL, type: REPORT_SUBMIT_FAIL,
error, error,
}; };
}; }
export function changeReportComment(comment) { export function changeReportComment(comment) {
return { return {
type: REPORT_COMMENT_CHANGE, type: REPORT_COMMENT_CHANGE,
comment, comment,
}; };
}; }
export function changeReportForward(forward) { export function changeReportForward(forward) {
return { return {
type: REPORT_FORWARD_CHANGE, type: REPORT_FORWARD_CHANGE,
forward, forward,
}; };
}; }
export function changeReportBlock(block) { export function changeReportBlock(block) {
return { return {
type: REPORT_BLOCK_CHANGE, type: REPORT_BLOCK_CHANGE,
block, block,
}; };
}; }

View File

@ -27,7 +27,7 @@ export function fetchScheduledStatuses() {
dispatch(fetchScheduledStatusesFail(error)); dispatch(fetchScheduledStatusesFail(error));
}); });
}; };
}; }
export function cancelScheduledStatus(id) { export function cancelScheduledStatus(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -44,7 +44,7 @@ export function fetchScheduledStatusesRequest() {
return { return {
type: SCHEDULED_STATUSES_FETCH_REQUEST, type: SCHEDULED_STATUSES_FETCH_REQUEST,
}; };
}; }
export function fetchScheduledStatusesSuccess(statuses, next) { export function fetchScheduledStatusesSuccess(statuses, next) {
return { return {
@ -52,14 +52,14 @@ export function fetchScheduledStatusesSuccess(statuses, next) {
statuses, statuses,
next, next,
}; };
}; }
export function fetchScheduledStatusesFail(error) { export function fetchScheduledStatusesFail(error) {
return { return {
type: SCHEDULED_STATUSES_FETCH_FAIL, type: SCHEDULED_STATUSES_FETCH_FAIL,
error, error,
}; };
}; }
export function expandScheduledStatuses() { export function expandScheduledStatuses() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -78,13 +78,13 @@ export function expandScheduledStatuses() {
dispatch(expandScheduledStatusesFail(error)); dispatch(expandScheduledStatusesFail(error));
}); });
}; };
}; }
export function expandScheduledStatusesRequest() { export function expandScheduledStatusesRequest() {
return { return {
type: SCHEDULED_STATUSES_EXPAND_REQUEST, type: SCHEDULED_STATUSES_EXPAND_REQUEST,
}; };
}; }
export function expandScheduledStatusesSuccess(statuses, next) { export function expandScheduledStatusesSuccess(statuses, next) {
return { return {
@ -92,11 +92,11 @@ export function expandScheduledStatusesSuccess(statuses, next) {
statuses, statuses,
next, next,
}; };
}; }
export function expandScheduledStatusesFail(error) { export function expandScheduledStatusesFail(error) {
return { return {
type: SCHEDULED_STATUSES_EXPAND_FAIL, type: SCHEDULED_STATUSES_EXPAND_FAIL,
error, error,
}; };
}; }

View File

@ -10,24 +10,24 @@ export const SEARCH_FETCH_REQUEST = 'SEARCH_FETCH_REQUEST';
export const SEARCH_FETCH_SUCCESS = 'SEARCH_FETCH_SUCCESS'; export const SEARCH_FETCH_SUCCESS = 'SEARCH_FETCH_SUCCESS';
export const SEARCH_FETCH_FAIL = 'SEARCH_FETCH_FAIL'; export const SEARCH_FETCH_FAIL = 'SEARCH_FETCH_FAIL';
export const SEARCH_FILTER_SET = 'SEARCH_FILTER_SET';
export const SEARCH_EXPAND_REQUEST = 'SEARCH_EXPAND_REQUEST'; export const SEARCH_EXPAND_REQUEST = 'SEARCH_EXPAND_REQUEST';
export const SEARCH_EXPAND_SUCCESS = 'SEARCH_EXPAND_SUCCESS'; export const SEARCH_EXPAND_SUCCESS = 'SEARCH_EXPAND_SUCCESS';
export const SEARCH_EXPAND_FAIL = 'SEARCH_EXPAND_FAIL'; export const SEARCH_EXPAND_FAIL = 'SEARCH_EXPAND_FAIL';
export const SEARCH_FILTER_SET = 'SEARCH_FILTER_SET';
export function changeSearch(value) { export function changeSearch(value) {
return { return {
type: SEARCH_CHANGE, type: SEARCH_CHANGE,
value, value,
}; };
}; }
export function clearSearch() { export function clearSearch() {
return { return {
type: SEARCH_CLEAR, type: SEARCH_CLEAR,
}; };
}; }
export function submitSearch() { export function submitSearch() {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -60,27 +60,35 @@ export function submitSearch() {
dispatch(fetchSearchFail(error)); dispatch(fetchSearchFail(error));
}); });
}; };
}; }
export function fetchSearchRequest(value) { export function fetchSearchRequest(value) {
return { return {
type: SEARCH_FETCH_REQUEST, type: SEARCH_FETCH_REQUEST,
value, value,
}; };
}; }
export function fetchSearchSuccess(results) { export function fetchSearchSuccess(results) {
return { return {
type: SEARCH_FETCH_SUCCESS, type: SEARCH_FETCH_SUCCESS,
results, results,
}; };
}; }
export function fetchSearchFail(error) { export function fetchSearchFail(error) {
return { return {
type: SEARCH_FETCH_FAIL, type: SEARCH_FETCH_FAIL,
error, error,
}; };
}
export const setFilter = filterType => dispatch => {
dispatch({
type: SEARCH_FILTER_SET,
path: ['search', 'filter'],
value: filterType,
});
}; };
export const expandSearch = type => (dispatch, getState) => { export const expandSearch = type => (dispatch, getState) => {

View File

@ -157,7 +157,7 @@ export function changeSetting(path, value) {
dispatch(saveSettings()); dispatch(saveSettings());
}; };
}; }
const debouncedSave = debounce((dispatch, getState) => { const debouncedSave = debounce((dispatch, getState) => {
if (!isLoggedIn(getState)) return; if (!isLoggedIn(getState)) return;
@ -180,4 +180,4 @@ const debouncedSave = debounce((dispatch, getState) => {
export function saveSettings() { export function saveSettings() {
return (dispatch, getState) => debouncedSave(dispatch, getState); return (dispatch, getState) => debouncedSave(dispatch, getState);
}; }

View File

@ -5,10 +5,10 @@ export function openSidebar() {
return { return {
type: SIDEBAR_OPEN, type: SIDEBAR_OPEN,
}; };
}; }
export function closeSidebar() { export function closeSidebar() {
return { return {
type: SIDEBAR_CLOSE, type: SIDEBAR_CLOSE,
}; };
}; }

View File

@ -8,15 +8,15 @@ const show = (severity, message) => ({
export function info(message) { export function info(message) {
return show('info', message); return show('info', message);
}; }
export function success(message) { export function success(message) {
return show('success', message); return show('success', message);
}; }
export function error(message) { export function error(message) {
return show('error', message); return show('error', message);
}; }
export default { export default {
info, info,

View File

@ -93,7 +93,7 @@ export function fetchSoapboxJson() {
export function importSoapboxConfig(soapboxConfig) { export function importSoapboxConfig(soapboxConfig) {
if (!soapboxConfig.brandColor) { if (!soapboxConfig.brandColor) {
soapboxConfig.brandColor = '#0482d8'; soapboxConfig.brandColor = '#0482d8';
}; }
return { return {
type: SOAPBOX_CONFIG_REQUEST_SUCCESS, type: SOAPBOX_CONFIG_REQUEST_SUCCESS,
soapboxConfig, soapboxConfig,

View File

@ -39,7 +39,7 @@ export function fetchStatusRequest(id, skipLoading) {
id, id,
skipLoading, skipLoading,
}; };
}; }
export function createStatus(params, idempotencyKey) { export function createStatus(params, idempotencyKey) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -55,7 +55,7 @@ export function createStatus(params, idempotencyKey) {
throw error; throw error;
}); });
}; };
}; }
export function fetchStatus(id) { export function fetchStatus(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -76,7 +76,7 @@ export function fetchStatus(id) {
dispatch(fetchStatusFail(id, error, skipLoading)); dispatch(fetchStatusFail(id, error, skipLoading));
}); });
}; };
}; }
export function fetchStatusSuccess(status, skipLoading) { export function fetchStatusSuccess(status, skipLoading) {
return { return {
@ -84,7 +84,7 @@ export function fetchStatusSuccess(status, skipLoading) {
status, status,
skipLoading, skipLoading,
}; };
}; }
export function fetchStatusFail(id, error, skipLoading) { export function fetchStatusFail(id, error, skipLoading) {
return { return {
@ -94,7 +94,7 @@ export function fetchStatusFail(id, error, skipLoading) {
skipLoading, skipLoading,
skipAlert: true, skipAlert: true,
}; };
}; }
export function redraft(status, raw_text) { export function redraft(status, raw_text) {
return { return {
@ -102,7 +102,7 @@ export function redraft(status, raw_text) {
status, status,
raw_text, raw_text,
}; };
}; }
export function deleteStatus(id, routerHistory, withRedraft = false) { export function deleteStatus(id, routerHistory, withRedraft = false) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -128,21 +128,21 @@ export function deleteStatus(id, routerHistory, withRedraft = false) {
dispatch(deleteStatusFail(id, error)); dispatch(deleteStatusFail(id, error));
}); });
}; };
}; }
export function deleteStatusRequest(id) { export function deleteStatusRequest(id) {
return { return {
type: STATUS_DELETE_REQUEST, type: STATUS_DELETE_REQUEST,
id: id, id: id,
}; };
}; }
export function deleteStatusSuccess(id) { export function deleteStatusSuccess(id) {
return { return {
type: STATUS_DELETE_SUCCESS, type: STATUS_DELETE_SUCCESS,
id: id, id: id,
}; };
}; }
export function deleteStatusFail(id, error) { export function deleteStatusFail(id, error) {
return { return {
@ -150,7 +150,7 @@ export function deleteStatusFail(id, error) {
id: id, id: id,
error: error, error: error,
}; };
}; }
export function fetchContext(id) { export function fetchContext(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -168,14 +168,14 @@ export function fetchContext(id) {
dispatch(fetchContextFail(id, error)); dispatch(fetchContextFail(id, error));
}); });
}; };
}; }
export function fetchContextRequest(id) { export function fetchContextRequest(id) {
return { return {
type: CONTEXT_FETCH_REQUEST, type: CONTEXT_FETCH_REQUEST,
id, id,
}; };
}; }
export function fetchContextSuccess(id, ancestors, descendants) { export function fetchContextSuccess(id, ancestors, descendants) {
return { return {
@ -184,7 +184,7 @@ export function fetchContextSuccess(id, ancestors, descendants) {
ancestors, ancestors,
descendants, descendants,
}; };
}; }
export function fetchContextFail(id, error) { export function fetchContextFail(id, error) {
return { return {
@ -193,7 +193,7 @@ export function fetchContextFail(id, error) {
error, error,
skipAlert: true, skipAlert: true,
}; };
}; }
export function muteStatus(id) { export function muteStatus(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -207,21 +207,21 @@ export function muteStatus(id) {
dispatch(muteStatusFail(id, error)); dispatch(muteStatusFail(id, error));
}); });
}; };
}; }
export function muteStatusRequest(id) { export function muteStatusRequest(id) {
return { return {
type: STATUS_MUTE_REQUEST, type: STATUS_MUTE_REQUEST,
id, id,
}; };
}; }
export function muteStatusSuccess(id) { export function muteStatusSuccess(id) {
return { return {
type: STATUS_MUTE_SUCCESS, type: STATUS_MUTE_SUCCESS,
id, id,
}; };
}; }
export function muteStatusFail(id, error) { export function muteStatusFail(id, error) {
return { return {
@ -229,7 +229,7 @@ export function muteStatusFail(id, error) {
id, id,
error, error,
}; };
}; }
export function unmuteStatus(id) { export function unmuteStatus(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -243,21 +243,21 @@ export function unmuteStatus(id) {
dispatch(unmuteStatusFail(id, error)); dispatch(unmuteStatusFail(id, error));
}); });
}; };
}; }
export function unmuteStatusRequest(id) { export function unmuteStatusRequest(id) {
return { return {
type: STATUS_UNMUTE_REQUEST, type: STATUS_UNMUTE_REQUEST,
id, id,
}; };
}; }
export function unmuteStatusSuccess(id) { export function unmuteStatusSuccess(id) {
return { return {
type: STATUS_UNMUTE_SUCCESS, type: STATUS_UNMUTE_SUCCESS,
id, id,
}; };
}; }
export function unmuteStatusFail(id, error) { export function unmuteStatusFail(id, error) {
return { return {
@ -265,7 +265,7 @@ export function unmuteStatusFail(id, error) {
id, id,
error, error,
}; };
}; }
export function hideStatus(ids) { export function hideStatus(ids) {
if (!Array.isArray(ids)) { if (!Array.isArray(ids)) {
@ -276,7 +276,7 @@ export function hideStatus(ids) {
type: STATUS_HIDE, type: STATUS_HIDE,
ids, ids,
}; };
}; }
export function revealStatus(ids) { export function revealStatus(ids) {
if (!Array.isArray(ids)) { if (!Array.isArray(ids)) {
@ -287,4 +287,4 @@ export function revealStatus(ids) {
type: STATUS_REVEAL, type: STATUS_REVEAL,
ids, ids,
}; };
}; }

View File

@ -17,14 +17,14 @@ export function fetchSuggestions() {
dispatch(fetchSuggestionsSuccess(response.data)); dispatch(fetchSuggestionsSuccess(response.data));
}).catch(error => dispatch(fetchSuggestionsFail(error))); }).catch(error => dispatch(fetchSuggestionsFail(error)));
}; };
}; }
export function fetchSuggestionsRequest() { export function fetchSuggestionsRequest() {
return { return {
type: SUGGESTIONS_FETCH_REQUEST, type: SUGGESTIONS_FETCH_REQUEST,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchSuggestionsSuccess(accounts) { export function fetchSuggestionsSuccess(accounts) {
return { return {
@ -32,7 +32,7 @@ export function fetchSuggestionsSuccess(accounts) {
accounts, accounts,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchSuggestionsFail(error) { export function fetchSuggestionsFail(error) {
return { return {
@ -41,7 +41,7 @@ export function fetchSuggestionsFail(error) {
skipLoading: true, skipLoading: true,
skipAlert: true, skipAlert: true,
}; };
}; }
export const dismissSuggestion = accountId => (dispatch, getState) => { export const dismissSuggestion = accountId => (dispatch, getState) => {
if (!isLoggedIn(getState)) return; if (!isLoggedIn(getState)) return;

View File

@ -47,7 +47,7 @@ export function updateTimeline(timeline, statusId, accept) {
statusId, statusId,
}); });
}; };
}; }
export function updateTimelineQueue(timeline, statusId, accept) { export function updateTimelineQueue(timeline, statusId, accept) {
return dispatch => { return dispatch => {
@ -61,7 +61,7 @@ export function updateTimelineQueue(timeline, statusId, accept) {
statusId, statusId,
}); });
}; };
}; }
export function dequeueTimeline(timelineId, expandFunc, optionalExpandArgs) { export function dequeueTimeline(timelineId, expandFunc, optionalExpandArgs) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -88,7 +88,7 @@ export function dequeueTimeline(timelineId, expandFunc, optionalExpandArgs) {
} }
} }
}; };
}; }
export function deleteFromTimelines(id) { export function deleteFromTimelines(id) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -104,13 +104,13 @@ export function deleteFromTimelines(id) {
reblogOf, reblogOf,
}); });
}; };
}; }
export function clearTimeline(timeline) { export function clearTimeline(timeline) {
return (dispatch) => { return (dispatch) => {
dispatch({ type: TIMELINE_CLEAR, timeline }); dispatch({ type: TIMELINE_CLEAR, timeline });
}; };
}; }
const noOp = () => {}; const noOp = () => {};
@ -148,7 +148,7 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) {
done(); done();
}); });
}; };
}; }
export const expandHomeTimeline = ({ maxId } = {}, done = noOp) => expandTimeline('home', '/api/v1/timelines/home', { max_id: maxId }, done); export const expandHomeTimeline = ({ maxId } = {}, done = noOp) => expandTimeline('home', '/api/v1/timelines/home', { max_id: maxId }, done);
@ -185,7 +185,7 @@ export function expandTimelineRequest(timeline, isLoadingMore) {
timeline, timeline,
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}; };
}; }
export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadingRecent, isLoadingMore) { export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadingRecent, isLoadingMore) {
return { return {
@ -197,7 +197,7 @@ export function expandTimelineSuccess(timeline, statuses, next, partial, isLoadi
isLoadingRecent, isLoadingRecent,
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}; };
}; }
export function expandTimelineFail(timeline, error, isLoadingMore) { export function expandTimelineFail(timeline, error, isLoadingMore) {
return { return {
@ -206,21 +206,21 @@ export function expandTimelineFail(timeline, error, isLoadingMore) {
error, error,
skipLoading: !isLoadingMore, skipLoading: !isLoadingMore,
}; };
}; }
export function connectTimeline(timeline) { export function connectTimeline(timeline) {
return { return {
type: TIMELINE_CONNECT, type: TIMELINE_CONNECT,
timeline, timeline,
}; };
}; }
export function disconnectTimeline(timeline) { export function disconnectTimeline(timeline) {
return { return {
type: TIMELINE_DISCONNECT, type: TIMELINE_DISCONNECT,
timeline, timeline,
}; };
}; }
export function scrollTopTimeline(timeline, top) { export function scrollTopTimeline(timeline, top) {
return { return {
@ -228,4 +228,4 @@ export function scrollTopTimeline(timeline, top) {
timeline, timeline,
top, top,
}; };
}; }

View File

@ -12,14 +12,14 @@ export function fetchTrends() {
dispatch(fetchTrendsSuccess(response.data)); dispatch(fetchTrendsSuccess(response.data));
}).catch(error => dispatch(fetchTrendsFail(error))); }).catch(error => dispatch(fetchTrendsFail(error)));
}; };
}; }
export function fetchTrendsRequest() { export function fetchTrendsRequest() {
return { return {
type: TRENDS_FETCH_REQUEST, type: TRENDS_FETCH_REQUEST,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchTrendsSuccess(tags) { export function fetchTrendsSuccess(tags) {
return { return {
@ -27,7 +27,7 @@ export function fetchTrendsSuccess(tags) {
tags, tags,
skipLoading: true, skipLoading: true,
}; };
}; }
export function fetchTrendsFail(error) { export function fetchTrendsFail(error) {
return { return {
@ -36,4 +36,4 @@ export function fetchTrendsFail(error) {
skipLoading: true, skipLoading: true,
skipAlert: true, skipAlert: true,
}; };
}; }

View File

@ -11,8 +11,8 @@ import { List as ImmutableList } from 'immutable';
const textAtCursorMatchesToken = (str, caretPosition, searchTokens) => { const textAtCursorMatchesToken = (str, caretPosition, searchTokens) => {
let word; let word;
let left = str.slice(0, caretPosition).search(/\S+$/); const left = str.slice(0, caretPosition).search(/\S+$/);
let right = str.slice(caretPosition).search(/\s/); const right = str.slice(caretPosition).search(/\s/);
if (right < 0) { if (right < 0) {
word = str.slice(left); word = str.slice(left);

View File

@ -11,8 +11,8 @@ import classNames from 'classnames';
const textAtCursorMatchesToken = (str, caretPosition) => { const textAtCursorMatchesToken = (str, caretPosition) => {
let word; let word;
let left = str.slice(0, caretPosition).search(/\S+$/); const left = str.slice(0, caretPosition).search(/\S+$/);
let right = str.slice(caretPosition).search(/\s/); const right = str.slice(caretPosition).search(/\s/);
if (right < 0) { if (right < 0) {
word = str.slice(left); word = str.slice(left);

View File

@ -35,7 +35,9 @@ function Blurhash({
useEffect(() => { useEffect(() => {
const { current: canvas } = canvasRef; const { current: canvas } = canvasRef;
canvas.width = canvas.width; // resets canvas
// resets canvas
canvas.width = canvas.width; // eslint-disable-line no-self-assign
if (dummy || !hash) return; if (dummy || !hash) return;

View File

@ -41,7 +41,7 @@ export default class ExtendedVideoPlayer extends React.PureComponent {
render() { render() {
const { src, muted, controls, alt } = this.props; const { src, muted, controls, alt } = this.props;
let conditionalAttributes = {}; const conditionalAttributes = {};
if (isIOS()) { if (isIOS()) {
conditionalAttributes.playsInline = '1'; conditionalAttributes.playsInline = '1';
} }

View File

@ -169,7 +169,7 @@ class Item extends React.PureComponent {
</a> </a>
); );
} else if (attachment.get('type') === 'gifv') { } else if (attachment.get('type') === 'gifv') {
let conditionalAttributes = {}; const conditionalAttributes = {};
if (isIOS()) { if (isIOS()) {
conditionalAttributes.playsInline = '1'; conditionalAttributes.playsInline = '1';
} }
@ -563,9 +563,8 @@ class MediaGallery extends React.PureComponent {
const { media, intl, sensitive } = this.props; const { media, intl, sensitive } = this.props;
const { visible } = this.state; const { visible } = this.state;
const sizeData = this.getSizeData(media.size); const sizeData = this.getSizeData(media.size);
let children, spoilerButton;
children = media.take(ATTACHMENT_LIMIT).map((attachment, i) => ( const children = media.take(ATTACHMENT_LIMIT).map((attachment, i) => (
<Item <Item
key={attachment.get('id')} key={attachment.get('id')}
onClick={this.handleClick} onClick={this.handleClick}
@ -580,6 +579,8 @@ class MediaGallery extends React.PureComponent {
/> />
)); ));
let spoilerButton;
if (visible) { if (visible) {
spoilerButton = <IconButton title={intl.formatMessage(messages.toggle_visible)} icon='eye-slash' overlay onClick={this.handleOpen} />; spoilerButton = <IconButton title={intl.formatMessage(messages.toggle_visible)} icon='eye-slash' overlay onClick={this.handleOpen} />;
} else { } else {

View File

@ -19,7 +19,7 @@ import {
const getAccount = makeGetAccount(); const getAccount = makeGetAccount();
const getBadges = (account) => { const getBadges = (account) => {
let badges = []; const badges = [];
if (isAdmin(account)) { if (isAdmin(account)) {
badges.push(<Badge key='admin' slug='admin' title='Admin' />); badges.push(<Badge key='admin' slug='admin' title='Admin' />);

View File

@ -14,4 +14,4 @@ export default class ProgressBar extends ImmutablePureComponent {
); );
} }
}; }

View File

@ -137,7 +137,7 @@ class RelativeTimestamp extends React.Component {
this.state.now !== nextState.now; this.state.now !== nextState.now;
} }
componentDidUpdate(prevProps) { UNSAFE_componentWillReceiveProps(prevProps) {
if (this.props.timestamp !== prevProps.timestamp) { if (this.props.timestamp !== prevProps.timestamp) {
this.setState({ now: Date.now() }); this.setState({ now: Date.now() });
} }
@ -147,7 +147,7 @@ class RelativeTimestamp extends React.Component {
this._scheduleNextUpdate(this.props, this.state); this._scheduleNextUpdate(this.props, this.state);
} }
componentDidUpdate() { UNSAFE_componentWillUpdate() {
this._scheduleNextUpdate(); this._scheduleNextUpdate();
} }

View File

@ -292,13 +292,13 @@ class Status extends ImmutablePureComponent {
render() { render() {
let media = null; let media = null;
let poll = null; const poll = null;
let statusAvatar, prepend, rebloggedByText, reblogContent; let statusAvatar, prepend, rebloggedByText, reblogContent;
const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props; const { intl, hidden, featured, otherAccounts, unread, showThread, group } = this.props;
let { status, account, ...other } = this.props; // FIXME: why does this need to reassign status and account??
let { status, account, ...other } = this.props; // eslint-disable-line prefer-const
if (status === null) { if (status === null) {
return null; return null;

View File

@ -93,8 +93,6 @@ class StatusActionBar extends ImmutablePureComponent {
allowedEmoji: ImmutablePropTypes.list, allowedEmoji: ImmutablePropTypes.list,
emojiSelectorFocused: PropTypes.bool, emojiSelectorFocused: PropTypes.bool,
handleEmojiSelectorUnfocus: PropTypes.func.isRequired, handleEmojiSelectorUnfocus: PropTypes.func.isRequired,
emojiSelectorFocused: PropTypes.bool,
handleEmojiSelectorUnfocus: PropTypes.func.isRequired,
}; };
static defaultProps = { static defaultProps = {
@ -245,7 +243,7 @@ class StatusActionBar extends ImmutablePureComponent {
textarea.select(); textarea.select();
document.execCommand('copy'); document.execCommand('copy');
} catch (e) { } catch (e) {
// Do nothing
} finally { } finally {
document.body.removeChild(textarea); document.body.removeChild(textarea);
} }
@ -284,7 +282,7 @@ class StatusActionBar extends ImmutablePureComponent {
const mutingConversation = status.get('muted'); const mutingConversation = status.get('muted');
const ownAccount = status.getIn(['account', 'id']) === me; const ownAccount = status.getIn(['account', 'id']) === me;
let menu = []; const menu = [];
menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen }); menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen });
@ -388,7 +386,7 @@ class StatusActionBar extends ImmutablePureComponent {
'😩': messages.reactionWeary, '😩': messages.reactionWeary,
}[meEmojiReact] || messages.favourite); }[meEmojiReact] || messages.favourite);
let menu = this._makeMenu(publicStatus); const menu = this._makeMenu(publicStatus);
let reblogIcon = 'retweet'; let reblogIcon = 'retweet';
let replyIcon; let replyIcon;
let replyTitle; let replyTitle;

View File

@ -50,8 +50,8 @@ class StatusContent extends React.PureComponent {
const links = node.querySelectorAll('a'); const links = node.querySelectorAll('a');
for (var i = 0; i < links.length; ++i) { for (let i = 0; i < links.length; ++i) {
let link = links[i]; const link = links[i];
if (link.classList.contains('status-link')) { if (link.classList.contains('status-link')) {
continue; continue;
} }
@ -59,7 +59,7 @@ class StatusContent extends React.PureComponent {
link.setAttribute('rel', 'nofollow noopener'); link.setAttribute('rel', 'nofollow noopener');
link.setAttribute('target', '_blank'); link.setAttribute('target', '_blank');
let mention = this.props.status.get('mentions').find(item => link.href === `${item.get('url')}`); const mention = this.props.status.get('mentions').find(item => link.href === `${item.get('url')}`);
if (mention) { if (mention) {
link.addEventListener('click', this.onMentionClick.bind(this, mention), false); link.addEventListener('click', this.onMentionClick.bind(this, mention), false);

View File

@ -38,7 +38,7 @@ export default class StatusList extends ImmutablePureComponent {
componentDidMount() { componentDidMount() {
this.handleDequeueTimeline(); this.handleDequeueTimeline();
}; }
getFeaturedStatusCount = () => { getFeaturedStatusCount = () => {
return this.props.featuredStatusIds ? this.props.featuredStatusIds.size : 0; return this.props.featuredStatusIds ? this.props.featuredStatusIds.size : 0;

View File

@ -93,7 +93,7 @@ class SoapboxMount extends React.PureComponent {
maybeUpdateMessages = prevProps => { maybeUpdateMessages = prevProps => {
if (this.props.locale !== prevProps.locale) { if (this.props.locale !== prevProps.locale) {
this.setMessages(); this.setMessages();
}; }
} }
componentDidMount() { componentDidMount() {

View File

@ -69,7 +69,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onReply(status, router) { onReply(status, router) {
dispatch((_, getState) => { dispatch((_, getState) => {
let state = getState(); const state = getState();
if (state.getIn(['compose', 'text']).trim().length !== 0) { if (state.getIn(['compose', 'text']).trim().length !== 0) {
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.replyMessage), message: intl.formatMessage(messages.replyMessage),

View File

@ -138,7 +138,7 @@ class Header extends ImmutablePureComponent {
makeMenu() { makeMenu() {
const { account, intl, me, meAccount, version } = this.props; const { account, intl, me, meAccount, version } = this.props;
let menu = []; const menu = [];
if (!account || !me) { if (!account || !me) {
return []; return [];
@ -245,7 +245,7 @@ class Header extends ImmutablePureComponent {
makeInfo() { makeInfo() {
const { account, me } = this.props; const { account, me } = this.props;
let info = []; const info = [];
if (!account || !me) return info; if (!account || !me) return info;
@ -262,7 +262,7 @@ class Header extends ImmutablePureComponent {
} }
return info; return info;
}; }
render() { render() {
const { account, intl, username, me } = this.props; const { account, intl, username, me } = this.props;

View File

@ -93,7 +93,7 @@ class MediaItem extends ImmutablePureComponent {
/> />
); );
} else if (['gifv', 'video'].indexOf(attachment.get('type')) !== -1) { } else if (['gifv', 'video'].indexOf(attachment.get('type')) !== -1) {
let conditionalAttributes = {}; const conditionalAttributes = {};
if (isIOS()) { if (isIOS()) {
conditionalAttributes.playsInline = '1'; conditionalAttributes.playsInline = '1';
} }

View File

@ -29,7 +29,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} else { } else {
let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); const account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
accountUsername = account ? account.getIn(['acct'], '') : ''; accountUsername = account ? account.getIn(['acct'], '') : '';
} }

View File

@ -29,7 +29,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} else { } else {
let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); const account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
accountUsername = account ? account.getIn(['acct'], '') : ''; accountUsername = account ? account.getIn(['acct'], '') : '';
accountApId = account ? account.get('url') : ''; accountApId = account ? account.get('url') : '';

View File

@ -81,6 +81,6 @@ class LatestAccountsPanel extends ImmutablePureComponent {
{...props} {...props}
/> />
); );
}; }
}; }

View File

@ -82,6 +82,6 @@ class RegistrationModePicker extends ImmutablePureComponent {
</FieldsGroup> </FieldsGroup>
</SimpleForm> </SimpleForm>
); );
}; }
} }

View File

@ -43,7 +43,7 @@ class ReportStatus extends ImmutablePureComponent {
if (status.get('media_attachments').size > 0) { if (status.get('media_attachments').size > 0) {
if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) { if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) {
// Do nothing
} else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
const video = status.getIn(['media_attachments', 0]); const video = status.getIn(['media_attachments', 0]);

View File

@ -40,7 +40,7 @@ class CaptchaField extends React.Component {
if (refreshInterval) { if (refreshInterval) {
const refresh = setInterval(this.fetchCaptcha, refreshInterval); const refresh = setInterval(this.fetchCaptcha, refreshInterval);
this.setState({ refresh }); this.setState({ refresh });
}; }
} }
endRefresh = () => { endRefresh = () => {

View File

@ -33,7 +33,7 @@ const timeChange = (prev, curr) => {
if (prevDate !== currDate) { if (prevDate !== currDate) {
return currDate === nowDate ? 'today' : 'date'; return currDate === nowDate ? 'today' : 'date';
}; }
return null; return null;
}; };

View File

@ -67,7 +67,7 @@ class ActionBar extends React.PureComponent {
const { intl, onClickLogOut, meUsername, isStaff } = this.props; const { intl, onClickLogOut, meUsername, isStaff } = this.props;
const size = this.props.size || 16; const size = this.props.size || 16;
let menu = []; const menu = [];
menu.push({ text: intl.formatMessage(messages.profile), to: `/@${meUsername}` }); menu.push({ text: intl.formatMessage(messages.profile), to: `/@${meUsername}` });
menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' }); menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' });

View File

@ -57,7 +57,7 @@ class ScheduleForm extends React.Component {
const selectedDate = new Date(time); const selectedDate = new Date(time);
return fiveMinutesFromNow.getTime() < selectedDate.getTime(); return fiveMinutesFromNow.getTime() < selectedDate.getTime();
}; }
handleRemove = e => { handleRemove = e => {
this.props.dispatch(removeSchedule()); this.props.dispatch(removeSchedule());

View File

@ -18,21 +18,15 @@ export default class SearchResults extends ImmutablePureComponent {
results: ImmutablePropTypes.map.isRequired, results: ImmutablePropTypes.map.isRequired,
submitted: PropTypes.bool, submitted: PropTypes.bool,
expandSearch: PropTypes.func.isRequired, expandSearch: PropTypes.func.isRequired,
}; selectedFilter: PropTypes.string.isRequired,
state = {
selectedFilter: 'accounts',
}; };
handleLoadMore = () => this.props.expandSearch(this.state.selectedFilter); handleLoadMore = () => this.props.expandSearch(this.state.selectedFilter);
handleSelectFilter = newActiveFilter => { handleSelectFilter = newActiveFilter => this.props.selectFilter(newActiveFilter);
this.setState({ selectedFilter: newActiveFilter });
};
render() { render() {
const { value, results, submitted } = this.props; const { value, results, submitted, selectedFilter } = this.props;
const { selectedFilter } = this.state;
if (submitted && results.isEmpty()) { if (submitted && results.isEmpty()) {
return ( return (
@ -101,7 +95,7 @@ export default class SearchResults extends ImmutablePureComponent {
return ( return (
<> <>
<FilterBar selectedFilter={submitted ? selectedFilter : null} selectFilter={this.handleSelectFilter} /> {submitted && <FilterBar selectedFilter={submitted ? selectedFilter : null} selectFilter={this.handleSelectFilter} />}
{searchResults} {searchResults}

View File

@ -38,7 +38,7 @@ const getFrequentlyUsedEmojis = createSelector([
.toArray(); .toArray();
if (emojis.length < DEFAULTS.length) { if (emojis.length < DEFAULTS.length) {
let uniqueDefaults = DEFAULTS.filter(emoji => !emojis.includes(emoji)); const uniqueDefaults = DEFAULTS.filter(emoji => !emojis.includes(emoji));
emojis = emojis.concat(uniqueDefaults.slice(0, DEFAULTS.length - emojis.length)); emojis = emojis.concat(uniqueDefaults.slice(0, DEFAULTS.length - emojis.length));
} }

View File

@ -1,7 +1,7 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import SearchResults from '../components/search_results'; import SearchResults from '../components/search_results';
import { fetchSuggestions, dismissSuggestion } from '../../../actions/suggestions'; import { fetchSuggestions, dismissSuggestion } from '../../../actions/suggestions';
import { expandSearch } from '../../../actions/search'; import { expandSearch, setFilter } from '../../../actions/search';
const mapStateToProps = state => { const mapStateToProps = state => {
return { return {
@ -9,6 +9,7 @@ const mapStateToProps = state => {
results: state.getIn(['search', 'results']), results: state.getIn(['search', 'results']),
suggestions: state.getIn(['suggestions', 'items']), suggestions: state.getIn(['suggestions', 'items']),
submitted: state.getIn(['search', 'submitted']), submitted: state.getIn(['search', 'submitted']),
selectedFilter: state.getIn(['search', 'filter']),
}; };
}; };
@ -16,6 +17,7 @@ const mapDispatchToProps = dispatch => ({
fetchSuggestions: () => dispatch(fetchSuggestions()), fetchSuggestions: () => dispatch(fetchSuggestions()),
expandSearch: type => dispatch(expandSearch(type)), expandSearch: type => dispatch(expandSearch(type)),
dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))), dismissSuggestion: account => dispatch(dismissSuggestion(account.get('id'))),
selectFilter: newActiveFilter => dispatch(setFilter(newActiveFilter)),
}); });
export default connect(mapStateToProps, mapDispatchToProps)(SearchResults); export default connect(mapStateToProps, mapDispatchToProps)(SearchResults);

View File

@ -6,4 +6,4 @@ export function countableText(inputText) {
return inputText return inputText
.replace(urlRegex, urlPlaceholder) .replace(urlRegex, urlPlaceholder)
.replace(/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/ig, '$1@$3'); .replace(/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/ig, '$1@$3');
}; }

View File

@ -16,7 +16,7 @@ const regexSupplant = function(regex, flags) {
regex = regex.source; regex = regex.source;
} }
return new RegExp(regex.replace(/#\{(\w+)\}/g, function(match, name) { return new RegExp(regex.replace(/#\{(\w+)\}/g, function(match, name) {
var newRegex = regexen[name] || ''; let newRegex = regexen[name] || '';
if (typeof newRegex !== 'string') { if (typeof newRegex !== 'string') {
newRegex = newRegex.source; newRegex = newRegex.source;
} }
@ -31,7 +31,7 @@ const stringSupplant = function(str, values) {
}; };
export const urlRegex = (function() { export const urlRegex = (function() {
regexen.spaces_group = /\x09-\x0D\x20\x85\xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000/; regexen.spaces_group = /\x09-\x0D\x20\x85\xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000/; // eslint-disable-line no-control-regex
regexen.invalid_chars_group = /\uFFFE\uFEFF\uFFFF\u202A-\u202E/; regexen.invalid_chars_group = /\uFFFE\uFEFF\uFFFF\u202A-\u202E/;
regexen.punct = /\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$/; regexen.punct = /\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$/;
regexen.validUrlPrecedingChars = regexSupplant(/(?:[^A-Za-z0-9@$##{invalid_chars_group}]|^)/); regexen.validUrlPrecedingChars = regexSupplant(/(?:[^A-Za-z0-9@$##{invalid_chars_group}]|^)/);

View File

@ -70,4 +70,4 @@ class CryptoDonatePanel extends ImmutablePureComponent {
); );
} }
}; }

View File

@ -142,8 +142,8 @@ class EditProfile extends ImmutablePureComponent {
getFormdata = () => { getFormdata = () => {
const data = this.getParams(); const data = this.getParams();
let formData = new FormData(); const formData = new FormData();
for (let key in data) { for (const key in data) {
// Compact the submission. This should probably be done better. // Compact the submission. This should probably be done better.
const shouldAppend = Boolean(data[key] !== undefined || key.startsWith('fields_attributes')); const shouldAppend = Boolean(data[key] !== undefined || key.startsWith('fields_attributes'));
if (shouldAppend) formData.append(key, data[key] || ''); if (shouldAppend) formData.append(key, data[key] || '');

View File

@ -18,6 +18,8 @@ const emojify = (str, customEmojis = {}, autoplay = false) => {
if (i === str.length) { if (i === str.length) {
break; break;
} else if (str[i] === ':') { } else if (str[i] === ':') {
// FIXME: This is insane.
/* eslint-disable no-loop-func */
if (!(() => { if (!(() => {
rend = str.indexOf(':', i + 1) + 1; rend = str.indexOf(':', i + 1) + 1;
if (!rend) return false; // no pair of ':' if (!rend) return false; // no pair of ':'
@ -33,6 +35,7 @@ const emojify = (str, customEmojis = {}, autoplay = false) => {
} }
return false; return false;
})()) rend = ++i; })()) rend = ++i;
/* eslint-enable no-loop-func */
} else if (tag >= 0) { // <, & } else if (tag >= 0) { // <, &
rend = str.indexOf('>;'[tag], i + 1) + 1; rend = str.indexOf('>;'[tag], i + 1) + 1;
if (!rend) { if (!rend) {

View File

@ -87,7 +87,7 @@ Object.keys(emojiIndex.emojis).forEach(key => {
} }
const { native } = emoji; const { native } = emoji;
let { short_names, search, unified } = emojiMartData.emojis[key]; const { short_names, search, unified } = emojiMartData.emojis[key];
if (short_names[0] !== key) { if (short_names[0] !== key) {
throw new Error('The compresser expects the first short_code to be the ' + throw new Error('The compresser expects the first short_code to be the ' +
@ -95,9 +95,11 @@ Object.keys(emojiIndex.emojis).forEach(key => {
'is no longer the case.'); 'is no longer the case.');
} }
short_names = short_names.slice(1); // first short name can be inferred from the key const searchData = [
native,
const searchData = [native, short_names, search]; short_names.slice(1), // first short name can be inferred from the key
search,
];
if (unicodeToUnifiedName(native) !== unified) { if (unicodeToUnifiedName(native) !== unified) {
// unified name can't be derived from unicodeToUnifiedName // unified name can't be derived from unicodeToUnifiedName

View File

@ -8,28 +8,22 @@ const emojis = {};
// decompress // decompress
Object.keys(shortCodesToEmojiData).forEach((shortCode) => { Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
let [ const [
filenameData, // eslint-disable-line no-unused-vars filenameData, // eslint-disable-line no-unused-vars
searchData, searchData,
] = shortCodesToEmojiData[shortCode]; ] = shortCodesToEmojiData[shortCode];
let [ const [
native, native,
short_names, short_names,
search, search,
unified, unified,
] = searchData; ] = searchData;
if (!unified) {
// unified name can be derived from unicodeToUnifiedName
unified = unicodeToUnifiedName(native);
}
short_names = [shortCode].concat(short_names);
emojis[shortCode] = { emojis[shortCode] = {
native, native,
search, search,
short_names, short_names: [shortCode].concat(short_names),
unified, unified: unified || unicodeToUnifiedName(native),
}; };
}); });

View File

@ -4,16 +4,16 @@
import data from './emoji_mart_data_light'; import data from './emoji_mart_data_light';
import { getData, getSanitizedData, uniq, intersect } from './emoji_utils'; import { getData, getSanitizedData, uniq, intersect } from './emoji_utils';
let originalPool = {}; const originalPool = {};
let index = {}; let index = {};
let emojisList = {}; const emojisList = {};
let emoticonsList = {}; const emoticonsList = {};
let customEmojisList = []; let customEmojisList = [];
for (let emoji in data.emojis) { for (const emoji in data.emojis) {
let emojiData = data.emojis[emoji]; const emojiData = data.emojis[emoji];
let { short_names, emoticons } = emojiData; const { short_names, emoticons } = emojiData;
let id = short_names[0]; const id = short_names[0];
if (emoticons) { if (emoticons) {
emoticons.forEach(emoticon => { emoticons.forEach(emoticon => {
@ -31,7 +31,7 @@ for (let emoji in data.emojis) {
function clearCustomEmojis(pool) { function clearCustomEmojis(pool) {
customEmojisList.forEach((emoji) => { customEmojisList.forEach((emoji) => {
let emojiId = emoji.id || emoji.short_names[0]; const emojiId = emoji.id || emoji.short_names[0];
delete pool[emojiId]; delete pool[emojiId];
delete emojisList[emojiId]; delete emojisList[emojiId];
@ -42,7 +42,7 @@ export function addCustomToPool(custom, pool = originalPool) {
if (customEmojisList.length) clearCustomEmojis(pool); if (customEmojisList.length) clearCustomEmojis(pool);
custom.forEach((emoji) => { custom.forEach((emoji) => {
let emojiId = emoji.id || emoji.short_names[0]; const emojiId = emoji.id || emoji.short_names[0];
if (emojiId && !pool[emojiId]) { if (emojiId && !pool[emojiId]) {
pool[emojiId] = getData(emoji); pool[emojiId] = getData(emoji);
@ -85,8 +85,8 @@ export function search(value, { emojisToShowFilter, maxResults, include, exclude
pool = {}; pool = {};
data.categories.forEach(category => { data.categories.forEach(category => {
let isIncluded = include && include.length ? include.indexOf(category.name.toLowerCase()) > -1 : true; const isIncluded = include && include.length ? include.indexOf(category.name.toLowerCase()) > -1 : true;
let isExcluded = exclude && exclude.length ? exclude.indexOf(category.name.toLowerCase()) > -1 : false; const isExcluded = exclude && exclude.length ? exclude.indexOf(category.name.toLowerCase()) > -1 : false;
if (!isIncluded || isExcluded) { if (!isIncluded || isExcluded) {
return; return;
} }
@ -95,8 +95,8 @@ export function search(value, { emojisToShowFilter, maxResults, include, exclude
}); });
if (custom.length) { if (custom.length) {
let customIsIncluded = include && include.length ? include.indexOf('custom') > -1 : true; const customIsIncluded = include && include.length ? include.indexOf('custom') > -1 : true;
let customIsExcluded = exclude && exclude.length ? exclude.indexOf('custom') > -1 : false; const customIsExcluded = exclude && exclude.length ? exclude.indexOf('custom') > -1 : false;
if (customIsIncluded && !customIsExcluded) { if (customIsIncluded && !customIsExcluded) {
addCustomToPool(custom, pool); addCustomToPool(custom, pool);
} }
@ -116,13 +116,13 @@ export function search(value, { emojisToShowFilter, maxResults, include, exclude
aIndex = aIndex[char]; aIndex = aIndex[char];
if (!aIndex.results) { if (!aIndex.results) {
let scores = {}; const scores = {};
aIndex.results = []; aIndex.results = [];
aIndex.pool = {}; aIndex.pool = {};
for (let id in aPool) { for (const id in aPool) {
let emoji = aPool[id], const emoji = aPool[id],
{ search } = emoji, { search } = emoji,
sub = value.substr(0, length), sub = value.substr(0, length),
subIndex = search.indexOf(sub); subIndex = search.indexOf(sub);
@ -139,7 +139,7 @@ export function search(value, { emojisToShowFilter, maxResults, include, exclude
} }
aIndex.results.sort((a, b) => { aIndex.results.sort((a, b) => {
let aScore = scores[a.id], const aScore = scores[a.id],
bScore = scores[b.id]; bScore = scores[b.id];
return aScore - bScore; return aScore - bScore;

View File

@ -15,19 +15,16 @@ const { unicodeToFilename } = require('./unicode_to_filename');
const unicodeMapping = {}; const unicodeMapping = {};
function processEmojiMapData(emojiMapData, shortCode) { function processEmojiMapData(emojiMapData, shortCode) {
let [ native, filename ] = emojiMapData; const [ native, filename ] = emojiMapData;
if (!filename) {
// filename name can be derived from unicodeToFilename
filename = unicodeToFilename(native);
}
unicodeMapping[native] = { unicodeMapping[native] = {
shortCode: shortCode, shortCode,
filename: filename, filename: filename || unicodeToFilename(native),
}; };
} }
Object.keys(shortCodesToEmojiData).forEach((shortCode) => { Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
let [ filenameData ] = shortCodesToEmojiData[shortCode]; const [ filenameData ] = shortCodesToEmojiData[shortCode];
filenameData.forEach(emojiMapData => processEmojiMapData(emojiMapData, shortCode)); filenameData.forEach(emojiMapData => processEmojiMapData(emojiMapData, shortCode));
}); });
emojisWithoutShortCodes.forEach(emojiMapData => processEmojiMapData(emojiMapData)); emojisWithoutShortCodes.forEach(emojiMapData => processEmojiMapData(emojiMapData));

View File

@ -6,7 +6,7 @@ import data from './emoji_mart_data_light';
const buildSearch = (data) => { const buildSearch = (data) => {
const search = []; const search = [];
let addToSearch = (strings, split) => { const addToSearch = (strings, split) => {
if (!strings) { if (!strings) {
return; return;
} }
@ -33,12 +33,12 @@ const buildSearch = (data) => {
const _String = String; const _String = String;
const stringFromCodePoint = _String.fromCodePoint || function() { const stringFromCodePoint = _String.fromCodePoint || function() {
let MAX_SIZE = 0x4000; const MAX_SIZE = 0x4000;
let codeUnits = []; const codeUnits = [];
let highSurrogate; let highSurrogate;
let lowSurrogate; let lowSurrogate;
let index = -1; let index = -1;
let length = arguments.length; const length = arguments.length;
if (!length) { if (!length) {
return ''; return '';
} }
@ -70,7 +70,6 @@ const stringFromCodePoint = _String.fromCodePoint || function() {
return result; return result;
}; };
const _JSON = JSON; const _JSON = JSON;
const COLONS_REGEX = /^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/; const COLONS_REGEX = /^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/;
@ -80,16 +79,16 @@ const SKINS = [
]; ];
function unifiedToNative(unified) { function unifiedToNative(unified) {
let unicodes = unified.split('-'), const unicodes = unified.split('-'),
codePoints = unicodes.map((u) => `0x${u}`); codePoints = unicodes.map((u) => `0x${u}`);
return stringFromCodePoint.apply(null, codePoints); return stringFromCodePoint.apply(null, codePoints);
} }
function sanitize(emoji) { function sanitize(emoji) {
let { name, short_names, skin_tone, skin_variations, emoticons, unified, custom, imageUrl } = emoji, const { name, short_names, skin_tone, skin_variations, emoticons, unified, custom, imageUrl } = emoji;
id = emoji.id || short_names[0], const id = emoji.id || short_names[0];
colons = `:${id}:`; const colons = `:${id}:`;
if (custom) { if (custom) {
return { return {
@ -102,14 +101,10 @@ function sanitize(emoji) {
}; };
} }
if (skin_tone) {
colons += `:skin-tone-${skin_tone}:`;
}
return { return {
id, id,
name, name,
colons, colons: skin_tone ? `${colons}:skin-tone-${skin_tone}:` : colons,
emoticons, emoticons,
unified: unified.toLowerCase(), unified: unified.toLowerCase(),
skin: skin_tone || (skin_variations ? 1 : null), skin: skin_tone || (skin_variations ? 1 : null),
@ -125,7 +120,7 @@ function getData(emoji, skin, set) {
let emojiData = {}; let emojiData = {};
if (typeof emoji === 'string') { if (typeof emoji === 'string') {
let matches = emoji.match(COLONS_REGEX); const matches = emoji.match(COLONS_REGEX);
if (matches) { if (matches) {
emoji = matches[1]; emoji = matches[1];
@ -135,19 +130,19 @@ function getData(emoji, skin, set) {
} }
} }
if (data.short_names.hasOwnProperty(emoji)) { if (Object.prototype.hasOwnProperty.call(data.short_names, emoji)) {
emoji = data.short_names[emoji]; emoji = data.short_names[emoji];
} }
if (data.emojis.hasOwnProperty(emoji)) { if (Object.prototype.hasOwnProperty.call(data.emojis, emoji)) {
emojiData = data.emojis[emoji]; emojiData = data.emojis[emoji];
} }
} else if (emoji.id) { } else if (emoji.id) {
if (data.short_names.hasOwnProperty(emoji.id)) { if (Object.prototype.hasOwnProperty.call(data.short_names, emoji.id)) {
emoji.id = data.short_names[emoji.id]; emoji.id = data.short_names[emoji.id];
} }
if (data.emojis.hasOwnProperty(emoji.id)) { if (Object.prototype.hasOwnProperty.call(data.emojis, emoji.id)) {
emojiData = data.emojis[emoji.id]; emojiData = data.emojis[emoji.id];
skin = skin || emoji.skin; skin = skin || emoji.skin;
} }
@ -168,7 +163,7 @@ function getData(emoji, skin, set) {
if (emojiData.skin_variations && skin > 1 && set) { if (emojiData.skin_variations && skin > 1 && set) {
emojiData = JSON.parse(_JSON.stringify(emojiData)); emojiData = JSON.parse(_JSON.stringify(emojiData));
let skinKey = SKINS[skin - 1], const skinKey = SKINS[skin - 1],
variationData = emojiData.skin_variations[skinKey]; variationData = emojiData.skin_variations[skinKey];
if (!variationData.variations && emojiData.variations) { if (!variationData.variations && emojiData.variations) {
@ -178,8 +173,8 @@ function getData(emoji, skin, set) {
if (variationData[`has_img_${set}`]) { if (variationData[`has_img_${set}`]) {
emojiData.skin_tone = skin; emojiData.skin_tone = skin;
for (let k in variationData) { for (const k in variationData) {
let v = variationData[k]; const v = variationData[k];
emojiData[k] = v; emojiData[k] = v;
} }
} }
@ -210,13 +205,13 @@ function intersect(a, b) {
} }
function deepMerge(a, b) { function deepMerge(a, b) {
let o = {}; const o = {};
for (let key in a) { for (const key in a) {
let originalValue = a[key], const originalValue = a[key];
value = originalValue; let value = originalValue;
if (b.hasOwnProperty(key)) { if (Object.prototype.hasOwnProperty.call(b, key)) {
value = b[key]; value = b[key];
} }

View File

@ -96,20 +96,20 @@ class Filters extends ImmutablePureComponent {
const { intl, dispatch } = this.props; const { intl, dispatch } = this.props;
const { phrase, whole_word, expires_at, irreversible } = this.state; const { phrase, whole_word, expires_at, irreversible } = this.state;
const { home_timeline, public_timeline, notifications, conversations } = this.state; const { home_timeline, public_timeline, notifications, conversations } = this.state;
let context = []; const context = [];
if (home_timeline) { if (home_timeline) {
context.push('home'); context.push('home');
}; }
if (public_timeline) { if (public_timeline) {
context.push('public'); context.push('public');
}; }
if (notifications) { if (notifications) {
context.push('notifications'); context.push('notifications');
}; }
if (conversations) { if (conversations) {
context.push('thread'); context.push('thread');
}; }
dispatch(createFilter(intl, phrase, expires_at, context, whole_word, irreversible)).then(response => { dispatch(createFilter(intl, phrase, expires_at, context, whole_word, irreversible)).then(response => {
return dispatch(fetchFilters()); return dispatch(fetchFilters());

View File

@ -28,7 +28,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} else { } else {
let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); const account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
} }

View File

@ -28,7 +28,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) { if (accountFetchError) {
accountId = null; accountId = null;
} else { } else {
let account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase()); const account = accounts.find(acct => username.toLowerCase() === acct.getIn(['acct'], '').toLowerCase());
accountId = account ? account.getIn(['id'], null) : -1; accountId = account ? account.getIn(['id'], null) : -1;
} }

View File

@ -26,7 +26,7 @@ class HashtagTimeline extends React.PureComponent {
}; };
title = () => { title = () => {
let title = [this.props.params.id]; const title = [this.props.params.id];
if (this.additionalFor('any')) { if (this.additionalFor('any')) {
title.push(' ', <FormattedMessage key='any' id='hashtag.column_header.tag_mode.any' values={{ additional: this.additionalFor('any') }} defaultMessage='or {additional}' />); title.push(' ', <FormattedMessage key='any' id='hashtag.column_header.tag_mode.any' values={{ additional: this.additionalFor('any') }} defaultMessage='or {additional}' />);
@ -54,13 +54,13 @@ class HashtagTimeline extends React.PureComponent {
} }
_subscribe(dispatch, id, tags = {}) { _subscribe(dispatch, id, tags = {}) {
let any = (tags.any || []).map(tag => tag.value); const any = (tags.any || []).map(tag => tag.value);
let all = (tags.all || []).map(tag => tag.value); const all = (tags.all || []).map(tag => tag.value);
let none = (tags.none || []).map(tag => tag.value); const none = (tags.none || []).map(tag => tag.value);
[id, ...any].map(tag => { [id, ...any].map(tag => {
this.disconnects.push(dispatch(connectHashtagStream(id, tag, status => { this.disconnects.push(dispatch(connectHashtagStream(id, tag, status => {
let tags = status.tags.map(tag => tag.name); const tags = status.tags.map(tag => tag.name);
return all.filter(tag => tags.includes(tag)).length === all.length && return all.filter(tag => tags.includes(tag)).length === all.length &&
none.filter(tag => tags.includes(tag)).length === 0; none.filter(tag => tags.includes(tag)).length === 0;

View File

@ -28,7 +28,7 @@ class CSVImporter extends ImmutablePureComponent {
handleSubmit = (event) => { handleSubmit = (event) => {
const { dispatch, action, intl } = this.props; const { dispatch, action, intl } = this.props;
let params = new FormData(); const params = new FormData();
params.append('list', this.state.file); params.append('list', this.state.file);
this.setState({ isLoading: true }); this.setState({ isLoading: true });

View File

@ -22,7 +22,7 @@ export default class ColumnSettings extends React.PureComponent {
onAllSoundsChange = (path, checked) => { onAllSoundsChange = (path, checked) => {
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll'], ['sounds', 'move']]; const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll'], ['sounds', 'move']];
for (var i = 0; i < soundSettings.length; i++) { for (let i = 0; i < soundSettings.length; i++) {
this.props.onChange(soundSettings[i], checked); this.props.onChange(soundSettings[i], checked);
} }
} }

View File

@ -19,7 +19,7 @@ export default class MultiSettingToggle extends React.PureComponent {
} }
onChange = ({ target }) => { onChange = ({ target }) => {
for (var i = 0; i < this.props.settingPaths.length; i++) { for (let i = 0; i < this.props.settingPaths.length; i++) {
this.props.onChange(this.props.settingPaths[i], target.checked); this.props.onChange(this.props.settingPaths[i], target.checked);
} }
} }

View File

@ -18,7 +18,7 @@ const mapStateToProps = (state, { params }) => {
statusIds: state.getIn(['status_lists', 'pins', 'items']), statusIds: state.getIn(['status_lists', 'pins', 'items']),
hasMore: !!state.getIn(['status_lists', 'pins', 'next']), hasMore: !!state.getIn(['status_lists', 'pins', 'next']),
}; };
};; };
export default @connect(mapStateToProps) export default @connect(mapStateToProps)
@injectIntl @injectIntl

View File

@ -26,7 +26,7 @@ export default class StatusCheckBox extends React.PureComponent {
if (status.get('media_attachments').size > 0) { if (status.get('media_attachments').size > 0) {
if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) { if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) {
// Do nothing
} else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
const video = status.getIn(['media_attachments', 0]); const video = status.getIn(['media_attachments', 0]);

View File

@ -87,4 +87,4 @@ class ScheduledStatus extends ImmutablePureComponent {
); );
} }
}; }

View File

@ -121,7 +121,7 @@ class IconPickerMenu extends React.PureComponent {
return <div style={{ width: 299 }} />; return <div style={{ width: 299 }} />;
} }
let data = { compressed: true, categories: [], aliases: [], emojis: [] }; const data = { compressed: true, categories: [], aliases: [], emojis: [] };
const title = intl.formatMessage(messages.emoji); const title = intl.formatMessage(messages.emoji);
const { modifierOpen } = this.state; const { modifierOpen } = this.state;
@ -209,7 +209,7 @@ class IconPickerDropdown extends React.PureComponent {
const { intl, onPickEmoji, value } = this.props; const { intl, onPickEmoji, value } = this.props;
const title = intl.formatMessage(messages.emoji); const title = intl.formatMessage(messages.emoji);
const { active, loading, placement } = this.state; const { active, loading, placement } = this.state;
let forkAwesomeIcons = require('../forkawesome.json'); const forkAwesomeIcons = require('../forkawesome.json');
return ( return (
<div className='font-icon-picker-dropdown' onKeyDown={this.handleKeyDown}> <div className='font-icon-picker-dropdown' onKeyDown={this.handleKeyDown}>

View File

@ -454,7 +454,7 @@ class ColorPicker extends React.PureComponent {
render() { render() {
const { style, value, onChange } = this.props; const { style, value, onChange } = this.props;
let margin_left_picker = isMobile(window.innerWidth) ? '20px' : '12px'; const margin_left_picker = isMobile(window.innerWidth) ? '20px' : '12px';
return ( return (
<div id='SketchPickerContainer' ref={this.setRef} style={{ ...style, marginLeft: margin_left_picker, position: 'absolute', zIndex: 1000 }}> <div id='SketchPickerContainer' ref={this.setRef} style={{ ...style, marginLeft: margin_left_picker, position: 'absolute', zIndex: 1000 }}>

View File

@ -244,7 +244,7 @@ class ActionBar extends React.PureComponent {
textarea.select(); textarea.select();
document.execCommand('copy'); document.execCommand('copy');
} catch (e) { } catch (e) {
// Do nothing
} finally { } finally {
document.body.removeChild(textarea); document.body.removeChild(textarea);
} }
@ -294,7 +294,7 @@ class ActionBar extends React.PureComponent {
'😩': messages.reactionWeary, '😩': messages.reactionWeary,
}[meEmojiReact] || messages.favourite); }[meEmojiReact] || messages.favourite);
let menu = []; const menu = [];
if (publicStatus) { if (publicStatus) {
menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy });
@ -360,7 +360,7 @@ class ActionBar extends React.PureComponent {
if (status.get('visibility') === 'direct') reblogIcon = 'envelope'; if (status.get('visibility') === 'direct') reblogIcon = 'envelope';
else if (status.get('visibility') === 'private') reblogIcon = 'lock'; else if (status.get('visibility') === 'private') reblogIcon = 'lock';
let reblog_disabled = (status.get('visibility') === 'direct' || status.get('visibility') === 'private'); const reblog_disabled = (status.get('visibility') === 'direct' || status.get('visibility') === 'private');
return ( return (

View File

@ -179,7 +179,7 @@ export default class Card extends React.PureComponent {
let embed = ''; let embed = '';
const imageUrl = card.get('image') || card.getIn(['pleroma', 'opengraph', 'thumbnail_url']); const imageUrl = card.get('image') || card.getIn(['pleroma', 'opengraph', 'thumbnail_url']);
let thumbnail = <div style={{ backgroundImage: `url(${imageUrl})`, width: horizontal ? width : null, height: horizontal ? height : null }} className='status-card__image-image' />; const thumbnail = <div style={{ backgroundImage: `url(${imageUrl})`, width: horizontal ? width : null, height: horizontal ? height : null }} className='status-card__image-image' />;
if (interactive) { if (interactive) {
if (embedded) { if (embedded) {

View File

@ -95,7 +95,7 @@ export default class DetailedStatus extends ImmutablePureComponent {
} }
let media = ''; let media = '';
let poll = ''; const poll = '';
let statusTypeIcon = ''; let statusTypeIcon = '';
if (this.props.measureHeight) { if (this.props.measureHeight) {

View File

@ -59,7 +59,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onReply(status, router) { onReply(status, router) {
dispatch((_, getState) => { dispatch((_, getState) => {
let state = getState(); const state = getState();
if (state.getIn(['compose', 'text']).trim().length !== 0) { if (state.getIn(['compose', 'text']).trim().length !== 0) {
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.replyMessage), message: intl.formatMessage(messages.replyMessage),

View File

@ -41,6 +41,7 @@ import StatusContainer from '../../containers/status_container';
import { openModal } from '../../actions/modal'; import { openModal } from '../../actions/modal';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { createSelector } from 'reselect';
import { HotKeys } from 'react-hotkeys'; import { HotKeys } from 'react-hotkeys';
import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen'; import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../ui/util/fullscreen';
import { textForScreenReader, defaultMediaVisibility } from '../../components/status'; import { textForScreenReader, defaultMediaVisibility } from '../../components/status';
@ -66,43 +67,54 @@ const messages = defineMessages({
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
const getStatus = makeGetStatus(); const getStatus = makeGetStatus();
const mapStateToProps = (state, props) => { const getAncestorsIds = createSelector([
const status = getStatus(state, { (_, { id }) => id,
id: props.params.statusId, state => state.getIn(['contexts', 'inReplyTos']),
username: props.params.username, ], (statusId, inReplyTos) => {
}); let ancestorsIds = Immutable.OrderedSet();
let id = statusId;
while (id) {
ancestorsIds = Immutable.OrderedSet([id]).union(ancestorsIds);
id = inReplyTos.get(id);
}
return ancestorsIds;
});
const getDescendantsIds = createSelector([
(_, { id }) => id,
state => state.getIn(['contexts', 'replies']),
], (statusId, contextReplies) => {
let descendantsIds = Immutable.OrderedSet();
const ids = [statusId];
while (ids.length > 0) {
const id = ids.shift();
const replies = contextReplies.get(id);
if (statusId !== id) {
descendantsIds = descendantsIds.union([id]);
}
if (replies) {
replies.reverse().forEach(reply => {
ids.unshift(reply);
});
}
}
return descendantsIds;
});
const mapStateToProps = (state, props) => {
const status = getStatus(state, { id: props.params.statusId });
let ancestorsIds = Immutable.List(); let ancestorsIds = Immutable.List();
let descendantsIds = Immutable.List(); let descendantsIds = Immutable.List();
if (status) { if (status) {
ancestorsIds = ancestorsIds.withMutations(mutable => { ancestorsIds = getAncestorsIds(state, { id: state.getIn(['contexts', 'inReplyTos', status.get('id')]) });
let id = state.getIn(['contexts', 'inReplyTos', status.get('id')]); descendantsIds = getDescendantsIds(state, { id: status.get('id') });
while (id) {
mutable.unshift(id);
id = state.getIn(['contexts', 'inReplyTos', id]);
}
});
descendantsIds = descendantsIds.withMutations(mutable => {
const ids = [status.get('id')];
while (ids.length > 0) {
let id = ids.shift();
const replies = state.getIn(['contexts', 'replies', id]);
if (status.get('id') !== id) {
mutable.push(id);
}
if (replies) {
replies.reverse().forEach(reply => {
ids.unshift(reply);
});
}
}
});
} }
const soapbox = getSoapboxConfig(state); const soapbox = getSoapboxConfig(state);
@ -187,7 +199,7 @@ class Status extends ImmutablePureComponent {
} }
handleReplyClick = (status) => { handleReplyClick = (status) => {
let { askReplyConfirmation, dispatch, intl } = this.props; const { askReplyConfirmation, dispatch, intl } = this.props;
if (askReplyConfirmation) { if (askReplyConfirmation) {
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
message: intl.formatMessage(messages.replyMessage), message: intl.formatMessage(messages.replyMessage),

View File

@ -51,6 +51,6 @@ export default class AccountListPanel extends ImmutablePureComponent {
</Link>} </Link>}
</div> </div>
); );
}; }
}; }

View File

@ -19,7 +19,7 @@ export default class ColumnLoading extends ImmutablePureComponent {
}; };
render() { render() {
let { title, icon } = this.props; const { title, icon } = this.props;
return ( return (
<Column> <Column>
<ColumnHeader icon={icon} title={title} focusable={false} /> <ColumnHeader icon={icon} title={title} focusable={false} />

View File

@ -60,7 +60,7 @@ class FundingPanel extends ImmutablePureComponent {
); );
} }
}; }
const mapStateToProps = state => { const mapStateToProps = state => {
return { return {

View File

@ -103,7 +103,7 @@ class ProfileDropdown extends React.PureComponent {
const { intl, account, otherAccounts } = this.props; const { intl, account, otherAccounts } = this.props;
const size = this.props.size || 16; const size = this.props.size || 16;
let menu = []; const menu = [];
menu.push({ text: this.renderAccount(account), to: `/@${account.get('acct')}` }); menu.push({ text: this.renderAccount(account), to: `/@${account.get('acct')}` });

View File

@ -64,9 +64,9 @@ class ProfileMediaPanel extends ImmutablePureComponent {
} }
</div> </div>
); );
}; }
}; }
const mapStateToProps = (state, { account }) => ({ const mapStateToProps = (state, { account }) => ({
attachments: getAccountGallery(state, account.get('id')), attachments: getAccountGallery(state, account.get('id')),

View File

@ -53,7 +53,7 @@ class TabsBar extends React.PureComponent {
getNavLinks() { getNavLinks() {
const { intl: { formatMessage }, logo, account, dashboardCount, notificationCount, chatsCount } = this.props; const { intl: { formatMessage }, logo, account, dashboardCount, notificationCount, chatsCount } = this.props;
let links = []; const links = [];
if (logo) { if (logo) {
links.push( links.push(
<Link key='logo' className='tabs-bar__link--logo' to='/' data-preview-title-id='column.home'> <Link key='logo' className='tabs-bar__link--logo' to='/' data-preview-title-id='column.home'>

View File

@ -48,9 +48,9 @@ class TrendsPanel extends ImmutablePureComponent {
</div> </div>
</div> </div>
); );
}; }
}; }
const mapStateToProps = state => ({ const mapStateToProps = state => ({

View File

@ -89,7 +89,7 @@ class UserPanel extends ImmutablePureComponent {
); );
} }
}; }
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
const getAccount = makeGetAccount(); const getAccount = makeGetAccount();

View File

@ -56,9 +56,9 @@ class WhoToFollowPanel extends ImmutablePureComponent {
</div> </div>
</div> </div>
); );
}; }
}; }
const mapStateToProps = state => ({ const mapStateToProps = state => ({
suggestions: state.getIn(['suggestions', 'items']), suggestions: state.getIn(['suggestions', 'items']),

View File

@ -336,7 +336,7 @@ class UI extends React.PureComponent {
try { try {
e.dataTransfer.dropEffect = 'copy'; e.dataTransfer.dropEffect = 'copy';
} catch (err) { } catch (err) {
// Do nothing
} }
return false; return false;

Some files were not shown because too many files have changed in this diff Show More