memory (sqla): Get original message in thread in history_get:
When using `thread_id` filter, original message could be missing (notably with a reply). We now include it with `History.uid == filters["thread_id"]`.
This commit is contained in:
parent
4b235fc86b
commit
b88d335d92
1 changed files with 7 additions and 1 deletions
|
|
@ -729,7 +729,13 @@ class Storage:
|
|||
if "origin_id" in filters:
|
||||
stmt = stmt.where(History.origin_id == filters["origin_id"])
|
||||
if "thread_id" in filters:
|
||||
stmt = stmt.where(Thread.thread_id == filters["thread_id"])
|
||||
# Include both replies and the parent message (thread_id is the parent uid)
|
||||
stmt = stmt.where(
|
||||
or_(
|
||||
Thread.thread_id == filters["thread_id"],
|
||||
History.uid == filters["thread_id"],
|
||||
)
|
||||
)
|
||||
if "keyword" in filters:
|
||||
keyword = filters["keyword"]
|
||||
# FIXME: "json_each" works with SQLite, but when PostGreSQL support will
|
||||
|
|
|
|||
Loading…
Reference in a new issue