mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-20 19:10:45 +03:00
preserve other pinned events on applying block
This commit is contained in:
parent
1e1afccacb
commit
7b83fcbd48
1 changed files with 5 additions and 3 deletions
|
@ -120,7 +120,7 @@ class ResourceLimitsServerNotices(object):
|
||||||
elif not currently_blocked and is_auth_blocking:
|
elif not currently_blocked and is_auth_blocking:
|
||||||
# Room is not notifying of a block, when it ought to be.
|
# Room is not notifying of a block, when it ought to be.
|
||||||
yield self._apply_limit_block_notification(
|
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:
|
except SynapseError as e:
|
||||||
logger.error("Error sending resource limits server notice: %s", e)
|
logger.error("Error sending resource limits server notice: %s", e)
|
||||||
|
@ -141,7 +141,9 @@ class ResourceLimitsServerNotices(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@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
|
"""Utility method to apply limit block notifications in the server
|
||||||
notices room.
|
notices room.
|
||||||
|
|
||||||
|
@ -162,7 +164,7 @@ class ResourceLimitsServerNotices(object):
|
||||||
user_id, content, EventTypes.Message
|
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(
|
yield self._server_notices_manager.send_notice(
|
||||||
user_id, content, EventTypes.Pinned, ""
|
user_id, content, EventTypes.Pinned, ""
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue