Remove Truth Social-specific features
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@ -6,7 +6,6 @@
|
||||
|
||||
import toast from 'soapbox/toast';
|
||||
import { getLoggedInAccount } from 'soapbox/utils/auth';
|
||||
import { parseVersion, TRUTHSOCIAL } from 'soapbox/utils/features';
|
||||
import { normalizeUsername } from 'soapbox/utils/input';
|
||||
|
||||
import api from '../api';
|
||||
@ -86,8 +85,6 @@ const changePassword = (oldPassword: string, newPassword: string, confirmation:
|
||||
const resetPassword = (usernameOrEmail: string) =>
|
||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||
const input = normalizeUsername(usernameOrEmail);
|
||||
const state = getState();
|
||||
const v = parseVersion(state.instance.version);
|
||||
|
||||
dispatch({ type: RESET_PASSWORD_REQUEST });
|
||||
|
||||
@ -96,12 +93,7 @@ const resetPassword = (usernameOrEmail: string) =>
|
||||
? { email: input }
|
||||
: { nickname: input, username: input };
|
||||
|
||||
const endpoint =
|
||||
v.software === TRUTHSOCIAL
|
||||
? '/api/v1/truth/password_reset/request'
|
||||
: '/auth/password';
|
||||
|
||||
return api(getState).post(endpoint, params).then(() => {
|
||||
return api(getState).post('/auth/password', params).then(() => {
|
||||
dispatch({ type: RESET_PASSWORD_SUCCESS });
|
||||
}).catch(error => {
|
||||
dispatch({ type: RESET_PASSWORD_FAIL, error });
|
||||
@ -109,19 +101,6 @@ const resetPassword = (usernameOrEmail: string) =>
|
||||
});
|
||||
};
|
||||
|
||||
const resetPasswordConfirm = (password: string, token: string) =>
|
||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||
const params = { password, reset_password_token: token };
|
||||
dispatch({ type: RESET_PASSWORD_CONFIRM_REQUEST });
|
||||
|
||||
return api(getState).post('/api/v1/truth/password_reset/confirm', params).then(() => {
|
||||
dispatch({ type: RESET_PASSWORD_CONFIRM_SUCCESS });
|
||||
}).catch(error => {
|
||||
dispatch({ type: RESET_PASSWORD_CONFIRM_FAIL, error });
|
||||
throw error;
|
||||
});
|
||||
};
|
||||
|
||||
const changeEmail = (email: string, password: string) =>
|
||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||
dispatch({ type: CHANGE_EMAIL_REQUEST, email });
|
||||
@ -137,10 +116,6 @@ const changeEmail = (email: string, password: string) =>
|
||||
});
|
||||
};
|
||||
|
||||
const confirmChangedEmail = (token: string) =>
|
||||
(_dispatch: AppDispatch, getState: () => RootState) =>
|
||||
api(getState).get(`/api/v1/truth/email/confirm?confirmation_token=${token}`);
|
||||
|
||||
const deleteAccount = (password: string) =>
|
||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||
const account = getLoggedInAccount(getState());
|
||||
@ -203,9 +178,7 @@ export {
|
||||
revokeOAuthTokenById,
|
||||
changePassword,
|
||||
resetPassword,
|
||||
resetPasswordConfirm,
|
||||
changeEmail,
|
||||
confirmChangedEmail,
|
||||
deleteAccount,
|
||||
moveAccount,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user