| ... |
... |
@@ -82,17 +82,18 @@ def _prepare_subject(self) -> None: |
|
82
|
82
|
text = self._contact.subject.text
|
|
83
|
83
|
|
|
84
|
84
|
self._ui.subject_textview.get_buffer().set_text(text)
|
|
85
|
|
-
|
|
86
|
|
- joined = self._contact.is_joined
|
|
87
|
|
- change_allowed = self._is_subject_change_allowed()
|
|
88
|
|
- self._ui.subject_textview.set_sensitive(joined and change_allowed)
|
|
|
85
|
+ self._ui.subject_textview.set_sensitive(
|
|
|
86
|
+ self._is_subject_change_allowed())
|
|
89
|
87
|
|
|
90
|
88
|
def _is_subject_change_allowed(self) -> bool:
|
|
91
|
|
- contact = self._contact.get_self()
|
|
92
|
|
- if contact is None:
|
|
|
89
|
+ if not self._contact.is_joined:
|
|
93
|
90
|
return False
|
|
94
|
91
|
|
|
95
|
|
- if contact.affiliation in (Affiliation.OWNER, Affiliation.ADMIN):
|
|
|
92
|
+ self_contact = self._contact.get_self()
|
|
|
93
|
+ if self_contact is None:
|
|
|
94
|
+ return False
|
|
|
95
|
+
|
|
|
96
|
+ if self_contact.affiliation in (Affiliation.OWNER, Affiliation.ADMIN):
|
|
96
|
97
|
return True
|
|
97
|
98
|
|
|
98
|
99
|
if self.disco_info is None:
|
| ... |
... |
@@ -131,8 +132,6 @@ def _on_room_subject(self, |
|
131
|
132
|
def _prepare_manage(self) -> None:
|
|
132
|
133
|
joined = self._contact.is_joined
|
|
133
|
134
|
vcard_support = False
|
|
134
|
|
- self_contact = self._contact.get_self()
|
|
135
|
|
- assert self_contact
|
|
136
|
135
|
|
|
137
|
136
|
if self.disco_info is not None:
|
|
138
|
137
|
vcard_support = self.disco_info.supports(Namespace.VCARD)
|
| ... |
... |
@@ -141,12 +140,15 @@ def _prepare_manage(self) -> None: |
|
141
|
140
|
self._ui.muc_description_entry.set_text(
|
|
142
|
141
|
self.disco_info.muc_description or '')
|
|
143
|
142
|
|
|
144
|
|
- if (joined and vcard_support and
|
|
145
|
|
- self_contact.affiliation.is_owner):
|
|
146
|
|
- self._ui.avatar_select_button.show()
|
|
147
|
|
-
|
|
148
|
143
|
self.update_avatar()
|
|
149
|
144
|
|
|
|
145
|
+ self_contact = self._contact.get_self()
|
|
|
146
|
+ if not joined or self_contact is None:
|
|
|
147
|
+ return
|
|
|
148
|
+
|
|
|
149
|
+ if vcard_support and self_contact.affiliation.is_owner:
|
|
|
150
|
+ self._ui.avatar_select_button.show()
|
|
|
151
|
+
|
|
150
|
152
|
if self_contact.affiliation.is_owner:
|
|
151
|
153
|
self._client.get_module('MUC').request_config(
|
|
152
|
154
|
self._contact.jid, callback=self._on_manage_form_received)
|