From 7b83fcbd4880d995fad72a83de57c3fd7cabecf9 Mon Sep 17 00:00:00 2001 From: Neil Johnson Date: Tue, 22 Oct 2019 17:24:02 +0100 Subject: preserve other pinned events on applying block --- synapse/server_notices/resource_limits_server_notices.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/synapse/server_notices/resource_limits_server_notices.py b/synapse/server_notices/resource_limits_server_notices.py index 0eca35aa4d..d36e555653 100644 --- a/synapse/server_notices/resource_limits_server_notices.py +++ b/synapse/server_notices/resource_limits_server_notices.py @@ -120,7 +120,7 @@ class ResourceLimitsServerNotices(object): elif not currently_blocked and is_auth_blocking: # Room is not notifying of a block, when it ought to be. yield self._apply_limit_block_notification( - user_id, event_body, event_limit_type + user_id, event_body, event_limit_type, ref_events ) except SynapseError as e: logger.error("Error sending resource limits server notice: %s", e) @@ -141,7 +141,9 @@ class ResourceLimitsServerNotices(object): ) @defer.inlineCallbacks - def _apply_limit_block_notification(self, user_id, event_body, event_limit_type): + def _apply_limit_block_notification( + self, user_id, event_body, event_limit_type, ref_events + ): """Utility method to apply limit block notifications in the server notices room. @@ -162,7 +164,7 @@ class ResourceLimitsServerNotices(object): user_id, content, EventTypes.Message ) - content = {"pinned": [event.event_id]} + content = {"pinned": ref_events.append(event.event_id)} yield self._server_notices_manager.send_notice( user_id, content, EventTypes.Pinned, "" ) -- cgit 1.4.1