Philipp Hörist pushed to branch master at gajim / gajim
Commits: 0b27c968 by lovetox at 2022-01-14T14:56:54+01:00 GroupchatSettings: Use JID instead of string
- - - - - 66575acf by lovetox at 2022-01-14T14:56:54+01:00 Settings: dict keys need to be strings
json.Encoder does only work for dict values not for keys.
- - - - -
3 changed files:
- gajim/common/settings.py - gajim/gtk/controls/groupchat.py - gajim/gtk/groupchat_settings.py
Changes:
===================================== gajim/common/settings.py ===================================== @@ -106,6 +106,7 @@ _CallbackDict = dict[tuple[str, Optional[str], Optional[JID]], list[weakref.WeakMethod[_SignalCallable]]]
+ class Settings: def __init__(self): self._con = cast(sqlite3.Connection, None) @@ -830,7 +831,7 @@ def set_group_chat_setting(self,
group_chat_settings = self._account_settings[account]['group_chat'] if jid not in group_chat_settings: - group_chat_settings[jid] = {setting: value} + group_chat_settings[str(jid)] = {setting: value} else: group_chat_settings[jid][setting] = value
@@ -909,7 +910,7 @@ def set_contact_setting(self,
contact_settings = self._account_settings[account]['contact'] if jid not in contact_settings: - contact_settings[jid] = {setting: value} + contact_settings[str(jid)] = {setting: value} else: contact_settings[jid][setting] = value
===================================== gajim/gtk/controls/groupchat.py ===================================== @@ -459,7 +459,7 @@ def _on_groupchat_settings(self, _action, _param): self._groupchat_settings_box.destroy()
self._groupchat_settings_box = GroupChatSettings( - self.account, self.room_jid) + self.account, self.contact.jid) self._groupchat_settings_box.show_all() self.xml.settings_scrolled_box.add(self._groupchat_settings_box) self._show_page('muc-settings')
===================================== gajim/gtk/groupchat_settings.py ===================================== @@ -13,6 +13,7 @@ # along with Gajim. If not, see http://www.gnu.org/licenses/.
from gi.repository import Gtk +from nbxmpp.protocol import JID
from gajim.common.const import THRESHOLD_OPTIONS from gajim.common.i18n import _ @@ -24,7 +25,7 @@
class GroupChatSettings(SettingsBox): - def __init__(self, account: str, jid: str) -> None: + def __init__(self, account: str, jid: JID) -> None: SettingsBox.__init__(self, account, jid)
self.get_style_context().add_class('settings-border')
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/bbafe882fa17592704f25cd2b3add602...