Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2023-05-29 01:37:23 +0300
committerwurstsalat <mailtrash@posteo.de>2023-05-29 01:37:27 +0300
commitbbc6c55d85362de5cbc2aab65680e9525518443f (patch)
treec388aa063e85c3e3b70200d76c9b7d5a2393a523
parent9b44d7693f3b478b6ed5bffd680f588f71aea59f (diff)
fix: GroupchatManage: Improve checks for joined state
Fixes #11231
-rw-r--r--gajim/gtk/groupchat_manage.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/gajim/gtk/groupchat_manage.py b/gajim/gtk/groupchat_manage.py
index f74b7a755..0a86c2305 100644
--- a/gajim/gtk/groupchat_manage.py
+++ b/gajim/gtk/groupchat_manage.py
@@ -82,17 +82,18 @@ class GroupchatManage(Gtk.Box):
text = self._contact.subject.text
self._ui.subject_textview.get_buffer().set_text(text)
-
- joined = self._contact.is_joined
- change_allowed = self._is_subject_change_allowed()
- self._ui.subject_textview.set_sensitive(joined and change_allowed)
+ self._ui.subject_textview.set_sensitive(
+ self._is_subject_change_allowed())
def _is_subject_change_allowed(self) -> bool:
- contact = self._contact.get_self()
- if contact is None:
+ if not self._contact.is_joined:
return False
- if contact.affiliation in (Affiliation.OWNER, Affiliation.ADMIN):
+ self_contact = self._contact.get_self()
+ if self_contact is None:
+ return False
+
+ if self_contact.affiliation in (Affiliation.OWNER, Affiliation.ADMIN):
return True
if self.disco_info is None:
@@ -131,8 +132,6 @@ class GroupchatManage(Gtk.Box):
def _prepare_manage(self) -> None:
joined = self._contact.is_joined
vcard_support = False
- self_contact = self._contact.get_self()
- assert self_contact
if self.disco_info is not None:
vcard_support = self.disco_info.supports(Namespace.VCARD)
@@ -141,12 +140,15 @@ class GroupchatManage(Gtk.Box):
self._ui.muc_description_entry.set_text(
self.disco_info.muc_description or '')
- if (joined and vcard_support and
- self_contact.affiliation.is_owner):
- self._ui.avatar_select_button.show()
-
self.update_avatar()
+ self_contact = self._contact.get_self()
+ if not joined or self_contact is None:
+ return
+
+ if vcard_support and self_contact.affiliation.is_owner:
+ self._ui.avatar_select_button.show()
+
if self_contact.affiliation.is_owner:
self._client.get_module('MUC').request_config(
self._contact.jid, callback=self._on_manage_form_received)