Mercurial > libervia-backend
diff sat/memory/sqla.py @ 3797:cc653b2685f0
core (memory/sqla), plugin XEP-0359: always add `origin-id`, and store:
`origin-id` is now always added to messages, and it is stored to database in the new
column instead of `extra` when present.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 17 Jun 2022 14:15:23 +0200 |
parents | af485e8afe03 |
children | b5013bada4b6 |
line wrap: on
line diff
--- a/sat/memory/sqla.py Fri Jun 17 14:15:23 2022 +0200 +++ b/sat/memory/sqla.py Fri Jun 17 14:15:23 2022 +0200 @@ -564,6 +564,8 @@ or limit != 1): raise ValueError("Unexpected values for last_stanza_id filter") stmt = stmt.where(History.stanza_id.is_not(None)) + if 'origin_id' in filters: + stmt = stmt.where(History.origin_id == filters["origin_id"]) if limit is not None: stmt = stmt.limit(limit) @@ -596,6 +598,7 @@ async with session.begin(): session.add(History( uid=data["uid"], + origin_id=data["extra"].get("origin_id"), stanza_id=data["extra"].get("stanza_id"), update_uid=data["extra"].get("update_uid"), profile_id=self.profiles[profile],