diff options
author | Neil Johnson <neil@matrix.org> | 2019-10-22 17:24:02 +0100 |
---|---|---|
committer | Neil Johnson <neil@matrix.org> | 2019-10-22 17:24:02 +0100 |
commit | 7b83fcbd4880d995fad72a83de57c3fd7cabecf9 (patch) | |
tree | 31095c93935d331802e38055f1d116aa7bbf0224 | |
parent | Merge branch 'neilj/disable-mau-alerting-for-small-instances' of github.com:m... (diff) | |
download | synapse-7b83fcbd4880d995fad72a83de57c3fd7cabecf9.tar.xz |
preserve other pinned events on applying block
-rw-r--r-- | synapse/server_notices/resource_limits_server_notices.py | 8 |
1 files 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, "" ) |