mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Third party event rules Update (#6781)
This commit is contained in:
parent
ed630ea17c
commit
99fcc96289
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
|
is_requester_admin (bool): If the requester is an admin
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
defer.Deferred
|
defer.Deferred[bool]: Whether room creation is allowed or denied.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.third_party_rules is None:
|
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
|
requester, config, is_requester_admin
|
||||||
)
|
)
|
||||||
|
return ret
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def check_threepid_can_be_invited(self, medium, address, room_id):
|
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
|
# Check whether the third party rules allows/changes the room create
|
||||||
# request.
|
# 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
|
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(
|
if not is_requester_admin and not self.spam_checker.user_may_create_room(
|
||||||
user_id
|
user_id
|
||||||
|
Loading…
Reference in New Issue
Block a user