From 12c4386108726f80ee84ba9fabf920332ba47ffb Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Tue, 14 Nov 2023 18:29:46 -0800 Subject: [PATCH] proper msg_id serialization --- src/server/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/mod.rs b/src/server/mod.rs index ffbdb99..a0c0971 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -47,10 +47,10 @@ pub async fn start(bot: Bot, config: AppConfig, bot_data: User, join_requests: J async fn verify_page( Extension(config): Extension, - Path((chat_id, msg_id)): Path<(ChatId, MessageId)>, + Path((chat_id, msg_id)): Path<(ChatId, i32)>, Extension(join_reqs): Extension, ) -> Result, StatusCode> { - if !join_reqs.contains_key(&(chat_id, msg_id)) { + if !join_reqs.contains_key(&(chat_id, MessageId(msg_id))) { return Err(StatusCode::NOT_FOUND); } @@ -102,10 +102,12 @@ struct VerifyRequest { async fn verify_api( Extension(bot): Extension, Extension(config): Extension, - Path((chat_id, msg_id)): Path<(ChatId, MessageId)>, + Path((chat_id, msg_id)): Path<(ChatId, i32)>, Extension(join_reqs): Extension, Json(req): Json, ) -> Result<&'static str, StatusCode> { + let msg_id = MessageId(msg_id); + let join_req = join_reqs .get(&(chat_id, msg_id)) .ok_or(StatusCode::NOT_FOUND)?;