From d417c7779ea583fc2e2ad8648a2916f42cf07c39 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 22 Apr 2019 17:38:55 -0700 Subject: [PATCH] modules/m_room_history_visibility: Massage the rules. --- modules/m_room_history_visibility.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/m_room_history_visibility.cc b/modules/m_room_history_visibility.cc index 160b2533b..3675ebb7c 100644 --- a/modules/m_room_history_visibility.cc +++ b/modules/m_room_history_visibility.cc @@ -23,7 +23,7 @@ _visible_(const m::event &event, const string_view &history_visibility) { char membership_buf[32]; - const string_view membership + string_view membership { room.membership(membership_buf, user_id) }; @@ -38,13 +38,16 @@ _visible_(const m::event &event, return membership == "invite"; assert(history_visibility == "shared"); + if(membership == "invite") + return true; // If the room is not at the present event then we have to run another // test for membership here. Otherwise the "join" test already failed. if(room.event_id) { const m::room present{room.room_id}; - return present.membership(user_id, "join"); + membership = present.membership(membership_buf, user_id); + return membership == "join" || membership == "invite"; } return false;