fix(invites): account for server bans
This commit is contained in:
1 parent
f0eb228b19
commit
7a9adb45f7
1 file changed
+5
-2
@@ -19,11 +19,14 @@ pub async fn req(db: &Db, user: User, target: Ref) -> Result<Value> {
|
||||
let invite = target.as_invite(db).await?;
|
||||
match &invite {
|
||||
Invite::Server { channel, server, .. } => {
|
||||
let channel = db.fetch_channel(channel).await?;
|
||||
let server = db.fetch_server(server).await?;
|
||||
if db.fetch_ban(&server.id, &user.id).await.is_ok() {
|
||||
return Err(Error::Banned)
|
||||
}
|
||||
|
||||
let channel = db.fetch_channel(channel).await?;
|
||||
db.insert_member(&server.id, &user.id).await?;
|
||||
|
||||
|
||||
Ok(json!({
|
||||
"type": "Server",
|
||||
"channel": channel,
|
||||
|
||||
Reference in new issue
Block a user