mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 02:13:52 +01:00
Third party event rules Update (#6781)
This commit is contained in:
parent
ed630ea17c
commit
99fcc96289
3 changed files with 10 additions and 4 deletions
1
changelog.d/6781.bugfix
Normal file
1
changelog.d/6781.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Fixed third party event rules function `on_create_room`'s return value being ignored.
|
|
@ -74,15 +74,16 @@ class ThirdPartyEventRules(object):
|
|||
is_requester_admin (bool): If the requester is an admin
|
||||
|
||||
Returns:
|
||||
defer.Deferred
|
||||
defer.Deferred[bool]: Whether room creation is allowed or denied.
|
||||
"""
|
||||
|
||||
if self.third_party_rules is None:
|
||||
return
|
||||
return True
|
||||
|
||||
yield self.third_party_rules.on_create_room(
|
||||
ret = yield self.third_party_rules.on_create_room(
|
||||
requester, config, is_requester_admin
|
||||
)
|
||||
return ret
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def check_threepid_can_be_invited(self, medium, address, room_id):
|
||||
|
|
|
@ -579,9 +579,13 @@ class RoomCreationHandler(BaseHandler):
|
|||
|
||||
# Check whether the third party rules allows/changes the room create
|
||||
# request.
|
||||
yield self.third_party_event_rules.on_create_room(
|
||||
event_allowed = yield self.third_party_event_rules.on_create_room(
|
||||
requester, config, is_requester_admin=is_requester_admin
|
||||
)
|
||||
if not event_allowed:
|
||||
raise SynapseError(
|
||||
403, "You are not permitted to create rooms", Codes.FORBIDDEN
|
||||
)
|
||||
|
||||
if not is_requester_admin and not self.spam_checker.user_may_create_room(
|
||||
user_id
|
||||
|
|
Loading…
Reference in a new issue