feat: Implement core chat application UI, including chat, voice, members, DMs, and shared components.
Some checks failed
Build and Release / build-and-release (push) Failing after 0s
Some checks failed
Build and Release / build-and-release (push) Failing after 0s
This commit is contained in:
@@ -229,6 +229,35 @@ export const afkMove = mutation({
|
||||
},
|
||||
});
|
||||
|
||||
export const disconnectUser = mutation({
|
||||
args: {
|
||||
actorUserId: v.id("userProfiles"),
|
||||
targetUserId: v.id("userProfiles"),
|
||||
},
|
||||
returns: v.null(),
|
||||
handler: async (ctx, args) => {
|
||||
const roles = await getRolesForUser(ctx, args.actorUserId);
|
||||
const canMove = roles.some(
|
||||
(role) => (role.permissions as Record<string, boolean>)?.["move_members"]
|
||||
);
|
||||
if (!canMove) {
|
||||
throw new Error("You don't have permission to disconnect members");
|
||||
}
|
||||
|
||||
// Clear viewers watching the target user's stream
|
||||
const allStates = await ctx.db.query("voiceStates").collect();
|
||||
for (const s of allStates) {
|
||||
if (s.watchingStream === args.targetUserId) {
|
||||
await ctx.db.patch(s._id, { watchingStream: undefined });
|
||||
}
|
||||
}
|
||||
|
||||
await removeUserVoiceStates(ctx, args.targetUserId);
|
||||
|
||||
return null;
|
||||
},
|
||||
});
|
||||
|
||||
export const moveUser = mutation({
|
||||
args: {
|
||||
actorUserId: v.id("userProfiles"),
|
||||
|
||||
Reference in New Issue
Block a user