mirror of
https://github.com/element-hq/synapse
synced 2024-09-01 22:40:21 +00:00
backout ability to pass in event type to server notices
This commit is contained in:
parent
9b75c78b4d
commit
e2c9fe0a6a
3 changed files with 5 additions and 4 deletions
|
@ -104,7 +104,7 @@ class ConsentServerNotices(object):
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
yield self._server_notices_manager.send_notice(
|
yield self._server_notices_manager.send_notice(
|
||||||
user_id, content, EventTypes.Message
|
user_id, content
|
||||||
)
|
)
|
||||||
yield self._store.user_set_consent_server_notice_sent(
|
yield self._store.user_set_consent_server_notice_sent(
|
||||||
user_id, self._current_consent_version,
|
user_id, self._current_consent_version,
|
||||||
|
|
|
@ -91,6 +91,7 @@ class ResourceLimitsServerNotices(object):
|
||||||
self._send_server_notice(user_id, content)
|
self._send_server_notice(user_id, content)
|
||||||
self._notified_of_blocking.add(user_id)
|
self._notified_of_blocking.add(user_id)
|
||||||
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _send_server_notice(self, user_id, content):
|
def _send_server_notice(self, user_id, content):
|
||||||
"""Sends Server notice
|
"""Sends Server notice
|
||||||
|
@ -104,7 +105,7 @@ class ResourceLimitsServerNotices(object):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
yield self._server_notices_manager.send_notice(
|
yield self._server_notices_manager.send_notice(
|
||||||
user_id, content, EventTypes.ServerNoticeLimitReached
|
user_id, content
|
||||||
)
|
)
|
||||||
except SynapseError as e:
|
except SynapseError as e:
|
||||||
logger.error("Error sending server notice about resource limits: %s", e)
|
logger.error("Error sending server notice about resource limits: %s", e)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ServerNoticesManager(object):
|
||||||
return self._config.server_notices_mxid is not None
|
return self._config.server_notices_mxid is not None
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def send_notice(self, user_id, event_content, type):
|
def send_notice(self, user_id, event_content):
|
||||||
"""Send a notice to the given user
|
"""Send a notice to the given user
|
||||||
|
|
||||||
Creates the server notices room, if none exists.
|
Creates the server notices room, if none exists.
|
||||||
|
@ -67,7 +67,7 @@ class ServerNoticesManager(object):
|
||||||
|
|
||||||
yield self._event_creation_handler.create_and_send_nonmember_event(
|
yield self._event_creation_handler.create_and_send_nonmember_event(
|
||||||
requester, {
|
requester, {
|
||||||
"type": type,
|
"type": EventTypes.Message,
|
||||||
"room_id": room_id,
|
"room_id": room_id,
|
||||||
"sender": system_mxid,
|
"sender": system_mxid,
|
||||||
"content": event_content,
|
"content": event_content,
|
||||||
|
|
Loading…
Reference in a new issue