Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: 508b0523 by wurstsalat at 2023-02-19T22:34:17+01:00 cfix: Improve get_recent_muc_nicks query - - - - - 1 changed file: - gajim/common/storage/archive.py Changes: ===================================== gajim/common/storage/archive.py ===================================== @@ -848,21 +848,22 @@ def get_recent_muc_nicks(self, contact: GroupchatContact) -> list[str]: ''' Queries the last 50 message rows and gathers nicknames in a list ''' + jids = [contact.jid] account_id = self.get_account_id(contact.account) + kinds = map(str, [KindConstant.GC_MSG]) sql = ''' SELECT contact_name - FROM logs NATURAL JOIN jids - WHERE +jid = ? - AND account_id = ? - AND kind = ? + FROM logs NATURAL JOIN jids WHERE jid IN ({jids}) + AND account_id = {account_id} + AND kind IN ({kinds}) ORDER BY time DESC - ''' + '''.format(jids=', '.join('?' * len(jids)), + account_id=account_id, + kinds=', '.join(kinds)) + - result = self._con.execute(sql, (contact.jid, - account_id, - KindConstant.GC_MSG - )).fetchmany(50) + result = self._con.execute(sql, (tuple(jids))).fetchmany(50) nicknames: list[str] = [] for row in result: View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/508b0523d3497f60d5fef00d015deec8ad9f8dff -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/508b0523d3497f60d5fef00d015deec8ad9f8dff You're receiving this email because of your account on dev.gajim.org.
_______________________________________________ Commits mailing list Commits@gajim.org https://lists.gajim.org/cgi-bin/listinfo/commits