summary refs log tree commit diff
diff options
context:
space:
mode:
authorHalf-Shot <will@half-shot.uk>2022-04-03 11:40:36 +0100
committerHalf-Shot <will@half-shot.uk>2022-04-03 11:40:36 +0100
commit79891c5578ab80abc6a20fd9222a713b32c38b4c (patch)
treeb820e08a12607f4e377b4963bdeec69422445b94
parentAdd new configuration (diff)
downloadsynapse-79891c5578ab80abc6a20fd9222a713b32c38b4c.tar.xz
Add "org.matrix.msc3759.deactivated" to leave events
-rw-r--r--synapse/handlers/deactivate_account.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/handlers/deactivate_account.py b/synapse/handlers/deactivate_account.py
index 816e1a6d79..d524e53eb5 100644
--- a/synapse/handlers/deactivate_account.py
+++ b/synapse/handlers/deactivate_account.py
@@ -192,6 +192,11 @@ class DeactivateAccountHandler:
         """
         user = UserID.from_string(user_id)
         pending_invites = await self.store.get_invited_rooms_for_local_user(user_id)
+        extra_content = (
+            {"org.matrix.msc3759.deactivated": True}
+            if self.hs.config.experimental.msc3759_enabled
+            else None
+        )
 
         for room in pending_invites:
             try:
@@ -202,6 +207,7 @@ class DeactivateAccountHandler:
                     "leave",
                     ratelimit=False,
                     require_consent=False,
+                    content=extra_content,
                 )
                 logger.info(
                     "Rejected invite for deactivated user %r in room %r",
@@ -246,6 +252,11 @@ class DeactivateAccountHandler:
         user = UserID.from_string(user_id)
 
         rooms_for_user = await self.store.get_rooms_for_user(user_id)
+        extra_content = (
+            {"org.matrix.msc3759.deactivated": True}
+            if self.hs.config.experimental.msc3759_enabled
+            else None
+        )
         for room_id in rooms_for_user:
             logger.info("User parter parting %r from %r", user_id, room_id)
             try:
@@ -256,6 +267,7 @@ class DeactivateAccountHandler:
                     "leave",
                     ratelimit=False,
                     require_consent=False,
+                    content=extra_content,
                 )
             except Exception:
                 logger.exception(