Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-05-13 19:00:42 +02:00
parent a58c52631e
commit cb3a900d39
639 changed files with 1185 additions and 887 deletions

View File

@@ -379,12 +379,12 @@ const submitCompose = (composeId: string, opts: SubmitComposeOpts = {}) =>
params.group_id = compose.group_id;
}
return dispatch(createStatus(params, idempotencyKey, statusId)).then(function(data) {
return dispatch(createStatus(params, idempotencyKey, statusId)).then((data) => {
if (!statusId && data.visibility === 'direct' && getState().conversations.mounted <= 0 && history) {
history.push('/messages');
}
handleComposeSubmit(dispatch, getState, composeId, data, status, !!statusId);
}).catch(function(error) {
}).catch((error) => {
dispatch(submitComposeFail(composeId, error));
});
};

View File

@@ -77,10 +77,10 @@ const emojiReact = (status: Status, emoji: string, custom?: string) =>
return api(getState)(`/api/v1/pleroma/statuses/${status.id}/reactions/${emoji}`, {
method: 'PUT',
}).then(function(response) {
}).then((response) => {
dispatch(importFetchedStatus(response.json));
dispatch(emojiReactSuccess(status, emoji));
}).catch(function(error) {
}).catch((error) => {
dispatch(emojiReactFail(status, emoji, error));
});
};

View File

@@ -237,7 +237,7 @@ const submitEvent = () =>
actionLink: `/@${data.account.acct}/events/${data.id}`,
},
);
}).catch(function(error) {
}).catch((error) => {
dispatch(submitEventFail(error));
});
};
@@ -281,7 +281,7 @@ const joinEvent = (id: string, participationMessage?: string) =>
actionLink: `/@${data.account.acct}/events/${data.id}`,
},
);
}).catch(function(error) {
}).catch((error) => {
dispatch(joinEventFail(error, status, status?.event?.join_state || null));
});
};
@@ -318,7 +318,7 @@ const leaveEvent = (id: string) =>
}).then(({ json: data }) => {
dispatch(importFetchedStatus(data));
dispatch(leaveEventSuccess(data));
}).catch(function(error) {
}).catch((error) => {
dispatch(leaveEventFail(error, status));
});
};

View File

@@ -88,12 +88,12 @@ const messages = defineMessages({
});
const reblog = (status: StatusEntity) =>
function(dispatch: AppDispatch, getState: () => RootState) {
(dispatch: AppDispatch, getState: () => RootState) => {
if (!isLoggedIn(getState)) return;
dispatch(reblogRequest(status));
api(getState)(`/api/v1/statuses/${status.id}/reblog`, { method: 'POST' }).then(function(response) {
api(getState)(`/api/v1/statuses/${status.id}/reblog`, { method: 'POST' }).then((response) => {
// The reblog API method returns a new status wrapped around the original. In this case we are only
// interested in how the original is modified, hence passing it skipping the wrapper
dispatch(importFetchedStatus(response.json.reblog));
@@ -169,9 +169,9 @@ const favourite = (status: StatusEntity) =>
dispatch(favouriteRequest(status));
api(getState)(`/api/v1/statuses/${status.id}/favourite`, { method: 'POST' }).then(function(response) {
api(getState)(`/api/v1/statuses/${status.id}/favourite`, { method: 'POST' }).then(() => {
dispatch(favouriteSuccess(status));
}).catch(function(error) {
}).catch((error) => {
dispatch(favouriteFail(status, error));
});
};
@@ -242,9 +242,9 @@ const dislike = (status: StatusEntity) =>
dispatch(dislikeRequest(status));
api(getState)(`/api/friendica/statuses/${status.id}/dislike`, { method: 'POST' }).then(function() {
api(getState)(`/api/friendica/statuses/${status.id}/dislike`, { method: 'POST' }).then(() => {
dispatch(dislikeSuccess(status));
}).catch(function(error) {
}).catch((error) => {
dispatch(dislikeFail(status, error));
});
};
@@ -321,7 +321,7 @@ const bookmark = (status: StatusEntity, folderId?: string) =>
return api(getState)(`/api/v1/statuses/${status.id}/bookmark`, {
method: 'POST',
body: folderId ? JSON.stringify({ folder_id: folderId }) : undefined,
}).then(function(response) {
}).then((response) => {
dispatch(importFetchedStatus(response.json));
dispatch(bookmarkSuccess(status, response.json));
@@ -339,7 +339,7 @@ const bookmark = (status: StatusEntity, folderId?: string) =>
}
toast.success(typeof folderId === 'string' ? messages.folderChanged : messages.bookmarkAdded, opts);
}).catch(function(error) {
}).catch((error) => {
dispatch(bookmarkFail(status, error));
});
};

View File

@@ -11,7 +11,7 @@ type OnboardingEndAction = {
type: typeof ONBOARDING_END;
}
export type OnboardingActions = OnboardingStartAction | OnboardingEndAction
type OnboardingActions = OnboardingStartAction | OnboardingEndAction
const checkOnboardingStatus = () => (dispatch: React.Dispatch<OnboardingActions>) => {
const needsOnboarding = localStorage.getItem(ONBOARDING_LOCAL_STORAGE_KEY) === '1';
@@ -32,6 +32,7 @@ const endOnboarding = () => (dispatch: React.Dispatch<OnboardingActions>) => {
};
export {
type OnboardingActions,
ONBOARDING_END,
ONBOARDING_START,
checkOnboardingStatus,