mirror of
https://github.com/spacebarchat/server.git
synced 2026-04-26 13:07:34 +00:00
Prevent duplicate instance ban entries
This commit is contained in:
@@ -62,7 +62,8 @@ router.post(
|
||||
select: [...PrivateUserProjection, "data"],
|
||||
});
|
||||
|
||||
await InstanceBan.create({ user_id: user.id, reason: body?.reason ?? "<legacy instance ban API - no reason specified>" }).save();
|
||||
if (!(await InstanceBan.findOne({ where: { user_id: user.id } })))
|
||||
await InstanceBan.create({ user_id: user.id, reason: body?.reason ?? "<legacy instance ban API - no reason specified>" }).save();
|
||||
|
||||
// prevent bugginess with clients - delete all DMs, only having half of the conversation is quite useless anyhow
|
||||
const dmChannels = await user.getDmChannels();
|
||||
|
||||
Reference in New Issue
Block a user