forked from administration/panel
fix: suspending works again, clarify bans
parent
32726dc7c6
commit
7360333523
|
@ -204,7 +204,7 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) {
|
|||
)
|
||||
}
|
||||
>
|
||||
Suspend
|
||||
{userDraft.flags === 1 ? "Unsuspend" : "Suspend"}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
|
@ -225,13 +225,18 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) {
|
|||
<AlertDialogTitle>
|
||||
Are you sure you want to ban this user?
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogDescription className="text-red-700">
|
||||
This action is irreversible!
|
||||
<AlertDialogDescription>
|
||||
All messages sent by this user will be deleted immediately.
|
||||
<br className="text-base/8" />
|
||||
<span className="text-red-700">
|
||||
This action is irreversible!
|
||||
</span>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
className="hover:bg-red-700 transition-all"
|
||||
onClick={() =>
|
||||
banUser(user._id)
|
||||
.then(() => {
|
||||
|
|
|
@ -7,10 +7,6 @@ import mongo, {
|
|||
ChannelInvite,
|
||||
createDM,
|
||||
fetchAccountById,
|
||||
fetchChannels,
|
||||
fetchMembershipsByUser,
|
||||
fetchMessages,
|
||||
fetchUserById,
|
||||
findDM,
|
||||
} from "./db";
|
||||
import { publishMessage, sendChatMessage } from "./redis";
|
||||
|
@ -29,7 +25,6 @@ import {
|
|||
User,
|
||||
} from "revolt-api";
|
||||
import { checkPermission } from "./accessPermissions";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export async function sendAlert(userId: string, content: string) {
|
||||
await checkPermission("users/create/alert", userId, { content });
|
||||
|
@ -321,7 +316,12 @@ export async function suspendUser(userId: string) {
|
|||
}
|
||||
);
|
||||
|
||||
const memberships = await fetchMembershipsByUser(userId);
|
||||
const memberships = await mongo()
|
||||
.db("revolt")
|
||||
.collection<{ _id: { user: string; server: string } }>("server_members")
|
||||
.find({ "_id.user": userId })
|
||||
.toArray();
|
||||
|
||||
for (const topic of memberships.map((x) => x._id.server)) {
|
||||
await publishMessage(topic, {
|
||||
type: "UserUpdate",
|
||||
|
|
Loading…
Reference in New Issue