make get_user_by_id return canonical handle

This commit is contained in:
2026-02-24 02:20:01 +01:00
parent fcf43dc0bc
commit f6feec2469

View File

@@ -58,11 +58,11 @@ impl User {
} }
pub fn get_by_handle(handle: UserHandle) -> Result<User, UserError> { pub fn get_by_handle(handle: UserHandle) -> Result<User, UserError> {
let res = database::conn()? let res = database::conn()?
.prepare("SELECT id FROM users WHERE handle = ?1")? .prepare("SELECT id, handle FROM users WHERE handle = ?1")?
.query_one((&handle,), |r| { .query_one((&handle,), |r| {
Ok(User { Ok(User {
id: r.get(0)?, id: r.get(0)?,
handle: handle.clone(), handle: r.get(1)?,
}) })
}) })
.optional()?; .optional()?;