forked from jmug/stoatchat
fix(invites): account for server bans
This commit is contained in:
@@ -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