mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: mark role as guest when kicking user
This commit is contained in:
1 file changed
+3
-1
@@ -190,8 +190,10 @@ class DomainUserHandler extends ManageHandler {
|
|||||||
const original = await domain.getMultiUserInDomain(domainId, { uid: { $in: uids } }).toArray();
|
const original = await domain.getMultiUserInDomain(domainId, { uid: { $in: uids } }).toArray();
|
||||||
const needUpdate = uids.filter((uid) => original.find((i) => i.uid === uid)?.join);
|
const needUpdate = uids.filter((uid) => original.find((i) => i.uid === uid)?.join);
|
||||||
if (!needUpdate.length) return;
|
if (!needUpdate.length) return;
|
||||||
|
const target = needUpdate.length > 1 ? needUpdate : needUpdate[0];
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
domain.setJoin(domainId, needUpdate.length > 1 ? needUpdate : needUpdate[0], false),
|
domain.setJoin(domainId, target, false),
|
||||||
|
domain.setUserRole(domainId, target, 'guest'),
|
||||||
oplog.log(this, 'domain.kick', { uids: needUpdate }),
|
oplog.log(this, 'domain.kick', { uids: needUpdate }),
|
||||||
]);
|
]);
|
||||||
const msg = JSON.stringify({
|
const msg = JSON.stringify({
|
||||||
|
|||||||
Reference in new issue
Block a user