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


Commits:
452d910c by Philipp Hörist at 2026-07-21T16:36:00+02:00
fix: GroupChat: Don't demote admins to members when inviting them

Fixes #12769

- - - - -


1 changed file:

- gajim/common/modules/muc.py


Changes:

=====================================
gajim/common/modules/muc.py
=====================================
@@ -1373,7 +1373,11 @@ def invite(
             affiliation = self_contact.affiliation
             admin = affiliation.is_owner or affiliation.is_admin
             if admin:
-                self.set_affiliation(room, {jid: {"affiliation": "member"}})
+                user_affiliation = self._muc_affiliations.get_user_affiliation(
+                    room, jid
+                )
+                if user_affiliation in ("outcast", None):
+                    self.set_affiliation(room, {jid: {"affiliation": 
"member"}})
                 type_ = InviteType.DIRECT
             else:
                 type_ = InviteType.MEDIATED
@@ -1498,3 +1502,10 @@ def get_users(
         if not include_outcast:
             affiliations.pop("outcast", None)
         return affiliations
+
+    def get_user_affiliation(self, muc_jid: JID, jid: JID) -> str | None:
+        affiliations = self._affiliations[muc_jid]
+        for affiliation in ("member", "admin", "owner", "outcast"):
+            if jid in affiliations.get(affiliation, []):
+                return affiliation
+        return None



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

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


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to