From 5860a395a05cf58e84666d24516a5bf3d7165bda Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 23 Apr 2019 19:42:48 -0700 Subject: [PATCH] modules/federation/event_auth: Make an exception to the visibility for cases. --- modules/federation/event_auth.cc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/federation/event_auth.cc b/modules/federation/event_auth.cc index 972dfedca..efeb75d08 100644 --- a/modules/federation/event_auth.cc +++ b/modules/federation/event_auth.cc @@ -64,7 +64,30 @@ get__event_auth(client &client, room_id, event_id }; - if(!room.visible(request.node_id)) + bool visible + { + room.visible(request.node_id) + }; + + // make an exception to the visibility for invitee cases. + if(!visible) + { + static const m::event::fetch::opts fopts + { + m::event::keys::include {"type", "state_key", "content"} + }; + + const m::event::fetch event + { + event_id, fopts + }; + + if(at<"type"_>(event) == "m.room.member") + if(m::user::id(at<"state_key"_>(event)).host() == request.origin) + visible = true; + } + + if(!visible) throw m::ACCESS_DENIED { "You are not permitted to view the room at this event"