'Check if the room is either world_readable or publically joinable'

@cachedInlineCallbacks(cache_context=True)
def is_room_world_readable_or_publicly_joinable(self, room_id, cache_context):

    current_state_ids = (yield self.get_current_state_ids(room_id, on_invalidate=cache_context.invalidate))
    join_rules_id = current_state_ids.get((EventTypes.JoinRules, ''))
    if join_rules_id:
        join_rule_ev = (yield self.get_event(join_rules_id, allow_none=True))
        if join_rule_ev:
            if (join_rule_ev.content.get('join_rule') == JoinRules.PUBLIC):
                defer.returnValue(True)
    hist_vis_id = current_state_ids.get((EventTypes.RoomHistoryVisibility, ''))
    if hist_vis_id:
        hist_vis_ev = (yield self.get_event(hist_vis_id, allow_none=True))
        if hist_vis_ev:
            if (hist_vis_ev.content.get('history_visibility') == 'world_readable'):
                defer.returnValue(True)
    defer.returnValue(False)
