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/**
/static/**
/static-test/**
/tmp/**
/coverage/**
!.eslintrc.js

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ export function fetchScheduledStatuses() {
dispatch(fetchScheduledStatusesFail(error));
});
};
};
}
export function cancelScheduledStatus(id) {
return (dispatch, getState) => {
@ -44,7 +44,7 @@ export function fetchScheduledStatusesRequest() {
return {
type: SCHEDULED_STATUSES_FETCH_REQUEST,
};
};
}
export function fetchScheduledStatusesSuccess(statuses, next) {
return {
@ -52,14 +52,14 @@ export function fetchScheduledStatusesSuccess(statuses, next) {
statuses,
next,
};
};
}
export function fetchScheduledStatusesFail(error) {
return {
type: SCHEDULED_STATUSES_FETCH_FAIL,
error,
};
};
}
export function expandScheduledStatuses() {
return (dispatch, getState) => {
@ -78,13 +78,13 @@ export function expandScheduledStatuses() {
dispatch(expandScheduledStatusesFail(error));
});
};
};
}
export function expandScheduledStatusesRequest() {
return {
type: SCHEDULED_STATUSES_EXPAND_REQUEST,
};
};
}
export function expandScheduledStatusesSuccess(statuses, next) {
return {
@ -92,11 +92,11 @@ export function expandScheduledStatusesSuccess(statuses, next) {
statuses,
next,
};
};
}
export function expandScheduledStatusesFail(error) {
return {
type: SCHEDULED_STATUSES_EXPAND_FAIL,
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_FAIL = 'SEARCH_FETCH_FAIL';
export const SEARCH_FILTER_SET = 'SEARCH_FILTER_SET';
export const SEARCH_EXPAND_REQUEST = 'SEARCH_EXPAND_REQUEST';
export const SEARCH_EXPAND_SUCCESS = 'SEARCH_EXPAND_SUCCESS';
export const SEARCH_EXPAND_FAIL = 'SEARCH_EXPAND_FAIL';
export const SEARCH_FILTER_SET = 'SEARCH_FILTER_SET';
export function changeSearch(value) {
return {
type: SEARCH_CHANGE,
value,
};
};
}
export function clearSearch() {
return {
type: SEARCH_CLEAR,
};
};
}
export function submitSearch() {
return (dispatch, getState) => {
@ -60,27 +60,35 @@ export function submitSearch() {
dispatch(fetchSearchFail(error));
});
};
};
}
export function fetchSearchRequest(value) {
return {
type: SEARCH_FETCH_REQUEST,
value,
};
};
}
export function fetchSearchSuccess(results) {
return {
type: SEARCH_FETCH_SUCCESS,
results,
};
};
}
export function fetchSearchFail(error) {
return {
type: SEARCH_FETCH_FAIL,
error,
};
}
export const setFilter = filterType => dispatch => {
dispatch({
type: SEARCH_FILTER_SET,
path: ['search', 'filter'],
value: filterType,
});
};
export const expandSearch = type => (dispatch, getState) => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,9 @@ function Blurhash({
useEffect(() => {
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;

View File

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

View File

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

View File

@ -19,7 +19,7 @@ import {
const getAccount = makeGetAccount();
const getBadges = (account) => {
let badges = [];
const badges = [];
if (isAdmin(account)) {
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;
}
componentDidUpdate(prevProps) {
UNSAFE_componentWillReceiveProps(prevProps) {
if (this.props.timestamp !== prevProps.timestamp) {
this.setState({ now: Date.now() });
}
@ -147,7 +147,7 @@ class RelativeTimestamp extends React.Component {
this._scheduleNextUpdate(this.props, this.state);
}
componentDidUpdate() {
UNSAFE_componentWillUpdate() {
this._scheduleNextUpdate();
}

View File

@ -292,13 +292,13 @@ class Status extends ImmutablePureComponent {
render() {
let media = null;
let poll = null;
const poll = null;
let statusAvatar, prepend, rebloggedByText, reblogContent;
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) {
return null;

View File

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

View File

@ -50,8 +50,8 @@ class StatusContent extends React.PureComponent {
const links = node.querySelectorAll('a');
for (var i = 0; i < links.length; ++i) {
let link = links[i];
for (let i = 0; i < links.length; ++i) {
const link = links[i];
if (link.classList.contains('status-link')) {
continue;
}
@ -59,7 +59,7 @@ class StatusContent extends React.PureComponent {
link.setAttribute('rel', 'nofollow noopener');
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) {
link.addEventListener('click', this.onMentionClick.bind(this, mention), false);

View File

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

View File

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

View File

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

View File

@ -138,7 +138,7 @@ class Header extends ImmutablePureComponent {
makeMenu() {
const { account, intl, me, meAccount, version } = this.props;
let menu = [];
const menu = [];
if (!account || !me) {
return [];
@ -245,7 +245,7 @@ class Header extends ImmutablePureComponent {
makeInfo() {
const { account, me } = this.props;
let info = [];
const info = [];
if (!account || !me) return info;
@ -262,7 +262,7 @@ class Header extends ImmutablePureComponent {
}
return info;
};
}
render() {
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) {
let conditionalAttributes = {};
const conditionalAttributes = {};
if (isIOS()) {
conditionalAttributes.playsInline = '1';
}

View File

@ -29,7 +29,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) {
accountId = null;
} 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;
accountUsername = account ? account.getIn(['acct'], '') : '';
}

View File

@ -29,7 +29,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) {
accountId = null;
} 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;
accountUsername = account ? account.getIn(['acct'], '') : '';
accountApId = account ? account.get('url') : '';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,7 +67,7 @@ class ActionBar extends React.PureComponent {
const { intl, onClickLogOut, meUsername, isStaff } = this.props;
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.lists), to: '/lists' });

View File

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

View File

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

View File

@ -38,7 +38,7 @@ const getFrequentlyUsedEmojis = createSelector([
.toArray();
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));
}

View File

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

View File

@ -6,4 +6,4 @@ export function countableText(inputText) {
return inputText
.replace(urlRegex, urlPlaceholder)
.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;
}
return new RegExp(regex.replace(/#\{(\w+)\}/g, function(match, name) {
var newRegex = regexen[name] || '';
let newRegex = regexen[name] || '';
if (typeof newRegex !== 'string') {
newRegex = newRegex.source;
}
@ -31,7 +31,7 @@ const stringSupplant = function(str, values) {
};
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.punct = /\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$/;
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 = () => {
const data = this.getParams();
let formData = new FormData();
for (let key in data) {
const formData = new FormData();
for (const key in data) {
// Compact the submission. This should probably be done better.
const shouldAppend = Boolean(data[key] !== undefined || key.startsWith('fields_attributes'));
if (shouldAppend) formData.append(key, data[key] || '');

View File

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

View File

@ -87,7 +87,7 @@ Object.keys(emojiIndex.emojis).forEach(key => {
}
const { native } = emoji;
let { short_names, search, unified } = emojiMartData.emojis[key];
const { short_names, search, unified } = emojiMartData.emojis[key];
if (short_names[0] !== key) {
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.');
}
short_names = short_names.slice(1); // first short name can be inferred from the key
const searchData = [native, short_names, search];
const searchData = [
native,
short_names.slice(1), // first short name can be inferred from the key
search,
];
if (unicodeToUnifiedName(native) !== unified) {
// unified name can't be derived from unicodeToUnifiedName

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) {
accountId = null;
} 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;
}

View File

@ -28,7 +28,7 @@ const mapStateToProps = (state, { params, withReplies = false }) => {
if (accountFetchError) {
accountId = null;
} 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;
}

View File

@ -26,7 +26,7 @@ class HashtagTimeline extends React.PureComponent {
};
title = () => {
let title = [this.props.params.id];
const title = [this.props.params.id];
if (this.additionalFor('any')) {
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 = {}) {
let any = (tags.any || []).map(tag => tag.value);
let all = (tags.all || []).map(tag => tag.value);
let none = (tags.none || []).map(tag => tag.value);
const any = (tags.any || []).map(tag => tag.value);
const all = (tags.all || []).map(tag => tag.value);
const none = (tags.none || []).map(tag => tag.value);
[id, ...any].map(tag => {
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 &&
none.filter(tag => tags.includes(tag)).length === 0;

View File

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

View File

@ -22,7 +22,7 @@ export default class ColumnSettings extends React.PureComponent {
onAllSoundsChange = (path, checked) => {
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);
}
}

View File

@ -19,7 +19,7 @@ export default class MultiSettingToggle extends React.PureComponent {
}
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);
}
}

View File

@ -18,7 +18,7 @@ const mapStateToProps = (state, { params }) => {
statusIds: state.getIn(['status_lists', 'pins', 'items']),
hasMore: !!state.getIn(['status_lists', 'pins', 'next']),
};
};;
};
export default @connect(mapStateToProps)
@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').some(item => item.get('type') === 'unknown')) {
// Do nothing
} else if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
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 }} />;
}
let data = { compressed: true, categories: [], aliases: [], emojis: [] };
const data = { compressed: true, categories: [], aliases: [], emojis: [] };
const title = intl.formatMessage(messages.emoji);
const { modifierOpen } = this.state;
@ -209,7 +209,7 @@ class IconPickerDropdown extends React.PureComponent {
const { intl, onPickEmoji, value } = this.props;
const title = intl.formatMessage(messages.emoji);
const { active, loading, placement } = this.state;
let forkAwesomeIcons = require('../forkawesome.json');
const forkAwesomeIcons = require('../forkawesome.json');
return (
<div className='font-icon-picker-dropdown' onKeyDown={this.handleKeyDown}>

View File

@ -454,7 +454,7 @@ class ColorPicker extends React.PureComponent {
render() {
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 (
<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();
document.execCommand('copy');
} catch (e) {
// Do nothing
} finally {
document.body.removeChild(textarea);
}
@ -294,7 +294,7 @@ class ActionBar extends React.PureComponent {
'😩': messages.reactionWeary,
}[meEmojiReact] || messages.favourite);
let menu = [];
const menu = [];
if (publicStatus) {
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';
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 (

View File

@ -179,7 +179,7 @@ export default class Card extends React.PureComponent {
let embed = '';
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 (embedded) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,7 @@ class TabsBar extends React.PureComponent {
getNavLinks() {
const { intl: { formatMessage }, logo, account, dashboardCount, notificationCount, chatsCount } = this.props;
let links = [];
const links = [];
if (logo) {
links.push(
<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>
);
};
}
};
}
const mapStateToProps = state => ({

View File

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

View File

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

View File

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

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