kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Refactor verification actions
rodzic
5eafa25ea9
commit
859eb77ffc
|
@ -244,6 +244,18 @@ export function untagUsers(accountIds, tags) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function verifyUser(accountId) {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
return dispatch(tagUsers([accountId], ['verified']));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unverifyUser(accountId) {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
return dispatch(untagUsers([accountId], ['verified']));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function addPermission(accountIds, permissionGroup) {
|
export function addPermission(accountIds, permissionGroup) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const nicknames = nicknamesFromIds(getState, accountIds);
|
const nicknames = nicknamesFromIds(getState, accountIds);
|
||||||
|
|
|
@ -27,8 +27,8 @@ import { getSettings } from 'soapbox/actions/settings';
|
||||||
import { startChat, openChat } from 'soapbox/actions/chats';
|
import { startChat, openChat } from 'soapbox/actions/chats';
|
||||||
import { deactivateUserModal, deleteUserModal } from 'soapbox/actions/moderation';
|
import { deactivateUserModal, deleteUserModal } from 'soapbox/actions/moderation';
|
||||||
import {
|
import {
|
||||||
tagUsers,
|
verifyUser,
|
||||||
untagUsers,
|
unverifyUser,
|
||||||
promoteToAdmin,
|
promoteToAdmin,
|
||||||
promoteToModerator,
|
promoteToModerator,
|
||||||
demoteToUser,
|
demoteToUser,
|
||||||
|
@ -184,16 +184,18 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
|
|
||||||
onVerifyUser(account) {
|
onVerifyUser(account) {
|
||||||
const message = intl.formatMessage(messages.userVerified, { acct: account.get('acct') });
|
const message = intl.formatMessage(messages.userVerified, { acct: account.get('acct') });
|
||||||
dispatch(tagUsers([account.get('id')], ['verified'])).then(() => {
|
|
||||||
dispatch(snackbar.success(message));
|
dispatch(verifyUser(account.get('id')))
|
||||||
}).catch(() => {});
|
.then(() => dispatch(snackbar.success(message)))
|
||||||
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
|
|
||||||
onUnverifyUser(account) {
|
onUnverifyUser(account) {
|
||||||
const message = intl.formatMessage(messages.userUnverified, { acct: account.get('acct') });
|
const message = intl.formatMessage(messages.userUnverified, { acct: account.get('acct') });
|
||||||
dispatch(untagUsers([account.get('id')], ['verified'])).then(() => {
|
|
||||||
dispatch(snackbar.info(message));
|
dispatch(unverifyUser(account.get('id')))
|
||||||
}).catch(() => {});
|
.then(() => dispatch(snackbar.success(message)))
|
||||||
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
|
|
||||||
onPromoteToAdmin(account) {
|
onPromoteToAdmin(account) {
|
||||||
|
|
Ładowanie…
Reference in New Issue