mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-27 10:29:26 -05:00
Merge pull request #449 from matrix-org/daniel/3pid
Add display_name to 3pid invite in m.room.member invites
This commit is contained in:
commit
633ceb9bb1
@ -1650,7 +1650,7 @@ class FederationHandler(BaseHandler):
|
|||||||
sender = invite["sender"]
|
sender = invite["sender"]
|
||||||
room_id = invite["room_id"]
|
room_id = invite["room_id"]
|
||||||
|
|
||||||
if "signed" not in invite:
|
if "signed" not in invite or "token" not in invite["signed"]:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Discarding received notification of third party invite "
|
"Discarding received notification of third party invite "
|
||||||
"without signed: %s" % (invite,)
|
"without signed: %s" % (invite,)
|
||||||
@ -1676,6 +1676,11 @@ class FederationHandler(BaseHandler):
|
|||||||
builder = self.event_builder_factory.new(event_dict)
|
builder = self.event_builder_factory.new(event_dict)
|
||||||
EventValidator().validate_new(builder)
|
EventValidator().validate_new(builder)
|
||||||
event, context = yield self._create_new_client_event(builder=builder)
|
event, context = yield self._create_new_client_event(builder=builder)
|
||||||
|
|
||||||
|
event, context = yield self.add_display_name_to_third_party_invite(
|
||||||
|
event_dict, event, context
|
||||||
|
)
|
||||||
|
|
||||||
self.auth.check(event, context.current_state)
|
self.auth.check(event, context.current_state)
|
||||||
yield self._validate_keyserver(event, auth_events=context.current_state)
|
yield self._validate_keyserver(event, auth_events=context.current_state)
|
||||||
member_handler = self.hs.get_handlers().room_member_handler
|
member_handler = self.hs.get_handlers().room_member_handler
|
||||||
@ -1697,6 +1702,10 @@ class FederationHandler(BaseHandler):
|
|||||||
builder=builder,
|
builder=builder,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
event, context = yield self.add_display_name_to_third_party_invite(
|
||||||
|
event_dict, event, context
|
||||||
|
)
|
||||||
|
|
||||||
self.auth.check(event, auth_events=context.current_state)
|
self.auth.check(event, auth_events=context.current_state)
|
||||||
yield self._validate_keyserver(event, auth_events=context.current_state)
|
yield self._validate_keyserver(event, auth_events=context.current_state)
|
||||||
|
|
||||||
@ -1706,6 +1715,27 @@ class FederationHandler(BaseHandler):
|
|||||||
member_handler = self.hs.get_handlers().room_member_handler
|
member_handler = self.hs.get_handlers().room_member_handler
|
||||||
yield member_handler.change_membership(event, context)
|
yield member_handler.change_membership(event, context)
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def add_display_name_to_third_party_invite(self, event_dict, event, context):
|
||||||
|
key = (
|
||||||
|
EventTypes.ThirdPartyInvite,
|
||||||
|
event.content["third_party_invite"]["signed"]["token"]
|
||||||
|
)
|
||||||
|
original_invite = context.current_state.get(key)
|
||||||
|
if not original_invite:
|
||||||
|
logger.info(
|
||||||
|
"Could not find invite event for third_party_invite - "
|
||||||
|
"discarding: %s" % (event_dict,)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
display_name = original_invite.content["display_name"]
|
||||||
|
event_dict["content"]["third_party_invite"]["display_name"] = display_name
|
||||||
|
builder = self.event_builder_factory.new(event_dict)
|
||||||
|
EventValidator().validate_new(builder)
|
||||||
|
event, context = yield self._create_new_client_event(builder=builder)
|
||||||
|
defer.returnValue((event, context))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _validate_keyserver(self, event, auth_events):
|
def _validate_keyserver(self, event, auth_events):
|
||||||
token = event.content["third_party_invite"]["signed"]["token"]
|
token = event.content["third_party_invite"]["signed"]["token"]
|
||||||
|
Loading…
Reference in New Issue
Block a user