mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
return unique token for new qr codes
as by reviving qr codes, there may be more than one token for a chat, ensure, the most recent token and only one token is returned by the sql-command for looking up tokens (used for generating new codes)
This commit is contained in:
@@ -69,7 +69,7 @@ pub async fn lookup(
|
||||
context
|
||||
.sql
|
||||
.query_get_value(
|
||||
"SELECT token FROM tokens WHERE namespc=? AND foreign_id=?;",
|
||||
"SELECT token FROM tokens WHERE namespc=? AND foreign_id=? ORDER BY timestamp DESC LIMIT 1;",
|
||||
paramsv![namespace, chat_id],
|
||||
)
|
||||
.await?
|
||||
@@ -79,7 +79,7 @@ pub async fn lookup(
|
||||
context
|
||||
.sql
|
||||
.query_get_value(
|
||||
"SELECT token FROM tokens WHERE namespc=? AND foreign_id=0;",
|
||||
"SELECT token FROM tokens WHERE namespc=? AND foreign_id=0 ORDER BY timestamp DESC LIMIT 1;",
|
||||
paramsv![namespace],
|
||||
)
|
||||
.await?
|
||||
|
||||
Reference in New Issue
Block a user