MCPcopy Create free account
hub / github.com/bytebase/bytebase / handleDeactivate

Function handleDeactivate

frontend/src/react/pages/settings/UsersPage.tsx:113–142  ·  view source on GitHub ↗
(user: User)

Source from the content-addressed store, hash-verified

111 }, [users, batchGetOrFetchGroups]);
112
113 const handleDeactivate = async (user: User) => {
114 const accountType = getAccountTypeByEmail(user.email);
115 const fullName = getUserFullNameByType(user);
116
117 const confirmed = window.confirm(
118 t("settings.members.action.deactivate-confirm-title")
119 );
120 if (!confirmed) return;
121
122 try {
123 if (accountType === AccountType.SERVICE_ACCOUNT) {
124 await deleteServiceAccount(fullName);
125 } else if (accountType === AccountType.WORKLOAD_IDENTITY) {
126 await deleteWorkloadIdentity(fullName);
127 } else {
128 await archiveUser(fullName);
129 }
130
131 const updated = create(UserSchema, { ...user, state: State.DELETED });
132 onUserUpdated(updated);
133
134 pushNotification({
135 module: "bytebase",
136 style: "SUCCESS",
137 title: t("common.updated"),
138 });
139 } catch {
140 // error already shown by store
141 }
142 };
143
144 const handleRestore = async (user: User) => {
145 const accountType = getAccountTypeByEmail(user.email);

Callers 1

UserTableFunction · 0.70

Calls 4

getAccountTypeByEmailFunction · 0.90
getUserFullNameByTypeFunction · 0.90
pushNotificationFunction · 0.90
tFunction · 0.50

Tested by

no test coverage detected