Philipp Hörist pushed to branch master at gajim / gajim


Commits:
d4eb4a35 by lovetox at 2022-07-13T20:09:26+02:00
fix: GroupchatInfo: Don’t set subject when loading from disco info

Disco provides only the subject text not the author and timestamp.
It’s better to set this info separately when we receive the subject
from the MUC. This has the drawback that we can’t show the subject
when we only show the disco (StartChatDialog). But everything else
would bring alot more complexity than it’s worth.

Fixes #11040

- - - - -


2 changed files:

- gajim/gtk/groupchat_info.py
- test/gtk/groupchat_info.py


Changes:

=====================================
gajim/gtk/groupchat_info.py
=====================================
@@ -191,9 +191,6 @@ def set_from_disco_info(self, info: DiscoInfo) -> None:
         if self._minimal:
             return
 
-        # Set subject
-        self.set_subject(info.muc_subject)
-
         # Set user
         has_users = info.muc_users is not None
         self._ui.users.set_text(info.muc_users or '')


=====================================
test/gtk/groupchat_info.py
=====================================
@@ -6,6 +6,7 @@
 
 from nbxmpp.protocol import Iq
 from nbxmpp.modules.discovery import parse_disco_info
+from nbxmpp.structs import MucSubject
 
 from gajim.common.const import CSSPriority
 
@@ -86,6 +87,10 @@
 </query>
 </iq>''')
 
+
+subject = ('Lorem ipsum dolor sit amet, consetetur sadipscing elitr sed '
+           'diam nonumy eirmod tempor invidunt ut labore et dolore magna')
+
 disco_info = parse_disco_info(stanza)
 
 class GroupchatInfo(Gtk.ApplicationWindow):
@@ -107,10 +112,9 @@ def __init__(self):
 
         self.add(self._main_box)
         self._muc_info_box.set_from_disco_info(disco_info)
-        self._muc_info_box.set_subject(
-            'Lorem ipsum dolor sit amet, consetetur sadipscing elitr sed '
-            'diam nonumy eirmod tempor invidunt ut labore et dolore magna')
-        self._muc_info_box.set_author('userX', None)
+        self._muc_info_box.set_subject(MucSubject(text=subject,
+                                                  author='someone',
+                                                  timestamp=None))
         self.show_all()
 
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/d4eb4a35c696599258c098460087505878b9fd76

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/d4eb4a35c696599258c098460087505878b9fd76
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to