mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 07:16:31 +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
|
context
|
||||||
.sql
|
.sql
|
||||||
.query_get_value(
|
.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],
|
paramsv![namespace, chat_id],
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
@@ -79,7 +79,7 @@ pub async fn lookup(
|
|||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
.query_get_value(
|
.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],
|
paramsv![namespace],
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
Reference in New Issue
Block a user