Philipp Hörist pushed to branch master at gajim / gajim
Commits: b704e27a by Philipp Hörist at 2019-03-06T22:03:45Z Write correct show values to database
Since the refactor we wrote accidentally string instead of int
- - - - -
3 changed files:
- gajim/common/helpers.py - gajim/common/modules/presence.py - gajim/history_manager.py
Changes:
===================================== gajim/common/helpers.py ===================================== @@ -56,6 +56,7 @@ from gajim.common import configpaths from gajim.common.i18n import Q_ from gajim.common.i18n import _ from gajim.common.i18n import ngettext +from gajim.common.const import ShowConstant
log = logging.getLogger('gajim.c.helpers')
@@ -246,6 +247,9 @@ def get_uf_show(show, use_mnemonic=False): If use_mnemonic is True, it adds _ so GUI should call with True for accessibility issues """ + if isinstance(show, ShowConstant): + show = show.name.lower() + if show == 'dnd': if use_mnemonic: uf_show = _('_Busy')
===================================== gajim/common/modules/presence.py ===================================== @@ -25,6 +25,7 @@ from gajim.common import app from gajim.common.i18n import _ from gajim.common.nec import NetworkEvent from gajim.common.const import KindConstant +from gajim.common.const import ShowConstant from gajim.common.helpers import prepare_and_validate_gpg_keyID
log = logging.getLogger('gajim.c.m.presence') @@ -236,11 +237,9 @@ class Presence: if not app.config.should_log(self._account, properties.jid.getBare()): return
- # TODO: Refactor + show = ShowConstant[properties.show.name] if properties.type.is_unavailable: - show = 'offline' - else: - show = properties.show.value + show = ShowConstant.OFFLINE
app.logger.insert_into_logs(self._account, properties.jid.getBare(),
===================================== gajim/history_manager.py ===================================== @@ -50,6 +50,7 @@ from gajim.common.i18n import _ from gajim.common.const import StyleAttr from gajim.common.const import JIDConstant from gajim.common.const import KindConstant +from gajim.common.const import ShowConstant
def is_standalone(): # Determine if we are in standalone mode @@ -398,7 +399,8 @@ class HistoryManager: message = '' else: message = ' : ' + message - message = helpers.get_uf_show(show) + message + + message = helpers.get_uf_show(ShowConstant(show)) + message
message_ = '<span' if color:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/b704e27abcb831f0ad2cc9d5d743352f4ee...