mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-18 16:02:15 +01:00
Block attempts to send server notices to remote users
This commit is contained in:
parent
9e8ab0a4f4
commit
321f02d263
1 changed files with 4 additions and 0 deletions
|
@ -35,6 +35,7 @@ class ServerNoticesManager(object):
|
||||||
self._config = hs.config
|
self._config = hs.config
|
||||||
self._room_creation_handler = hs.get_room_creation_handler()
|
self._room_creation_handler = hs.get_room_creation_handler()
|
||||||
self._event_creation_handler = hs.get_event_creation_handler()
|
self._event_creation_handler = hs.get_event_creation_handler()
|
||||||
|
self._is_mine_id = hs.is_mine_id
|
||||||
|
|
||||||
def is_enabled(self):
|
def is_enabled(self):
|
||||||
"""Checks if server notices are enabled on this server.
|
"""Checks if server notices are enabled on this server.
|
||||||
|
@ -89,6 +90,9 @@ class ServerNoticesManager(object):
|
||||||
if not self.is_enabled():
|
if not self.is_enabled():
|
||||||
raise Exception("Server notices not enabled")
|
raise Exception("Server notices not enabled")
|
||||||
|
|
||||||
|
assert self._is_mine_id(user_id), \
|
||||||
|
"Cannot send server notices to remote users"
|
||||||
|
|
||||||
rooms = yield self._store.get_rooms_for_user_where_membership_is(
|
rooms = yield self._store.get_rooms_for_user_where_membership_is(
|
||||||
user_id, [Membership.INVITE, Membership.JOIN],
|
user_id, [Membership.INVITE, Membership.JOIN],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue