fix bug related to chat permission requests when approve/decline commands may targeted wrong chats because of wrong sql query
This commit is contained in:
parent
59da98cc7f
commit
98305e7dee
1 changed files with 2 additions and 3 deletions
|
|
@ -110,12 +110,11 @@ pub async fn cmd_approve_chat(bot: Bot, msg: Message, id: String, db: DbPool) ->
|
||||||
}
|
}
|
||||||
|
|
||||||
// get request
|
// get request
|
||||||
// BUG: FIX SQL
|
|
||||||
let res: Result<RequestChatWithChat, sqlx::Error> = sqlx::query_as(
|
let res: Result<RequestChatWithChat, sqlx::Error> = sqlx::query_as(
|
||||||
r#"SELECT "request_chat".id AS request_id, "request_chat".message, "chat".*
|
r#"SELECT "request_chat".id AS request_id, "request_chat".message, "chat".*
|
||||||
FROM "request_chat"
|
FROM "request_chat"
|
||||||
INNER JOIN "chat" ON "request_chat".requested_for = "chat".id
|
INNER JOIN "chat" ON "request_chat".requested_for = "chat".id
|
||||||
WHERE "request_chat".is_approved = false
|
WHERE "request_chat".id = $1 AND "request_chat".is_approved = false
|
||||||
LIMIT 1;"#,
|
LIMIT 1;"#,
|
||||||
)
|
)
|
||||||
.bind(id)
|
.bind(id)
|
||||||
|
|
@ -171,7 +170,7 @@ pub async fn cmd_decline_chat(bot: Bot, msg: Message, id: String, db: DbPool) ->
|
||||||
r#"SELECT "request_chat".id AS request_id, "request_chat".message, "chat".*
|
r#"SELECT "request_chat".id AS request_id, "request_chat".message, "chat".*
|
||||||
FROM "request_chat"
|
FROM "request_chat"
|
||||||
INNER JOIN "chat" ON "request_chat".requested_for = "chat".id
|
INNER JOIN "chat" ON "request_chat".requested_for = "chat".id
|
||||||
WHERE "request_chat".is_approved = false
|
WHERE "request_chat".id = $1 AND "request_chat".is_approved = false
|
||||||
LIMIT 1;"#,
|
LIMIT 1;"#,
|
||||||
)
|
)
|
||||||
.bind(id)
|
.bind(id)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue