Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: 45f63468 by wurstsalat at 2022-10-24T21:31:51+02:00 fix: Settings: Check if account is connected before trying to get context
Fixes #11243
- - - - -
1 changed file:
- gajim/common/settings.py
Changes:
===================================== gajim/common/settings.py ===================================== @@ -913,15 +913,16 @@ def set_group_chat_setting(self,
default = ACCOUNT_SETTINGS['group_chat'][setting] if default in (HAS_APP_DEFAULT, HAS_ACCOUNT_DEFAULT): - - client = app.get_client(account) - contact = client.get_module('Contacts').get_contact(jid) - context = contact.muc_context - if context is None: - # If there is no disco info available - # to determine the context assume public - log.warning('Unable to determine context for: %s', jid) - context = 'public' + context = 'public' + if app.account_is_connected(account): + client = app.get_client(account) + contact = client.get_module('Contacts').get_contact(jid) + context = contact.muc_context + if context is None: + # If there is no disco info available + # to determine the context assume public + log.warning('Unable to determine context for: %s', jid) + context = 'public'
default_store = APP_SETTINGS if default is HAS_ACCOUNT_DEFAULT: @@ -957,7 +958,8 @@ def set_group_chat_setting(self, def set_group_chat_settings(self, setting: str, value: SETTING_TYPE, - context: str = None) -> None: + context: Optional[str] = None + ) -> None:
for account, acc_settings in self._account_settings.items(): for jid in acc_settings['group_chat']:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/45f63468d109a6805d4c954f6536c4363...