mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 14:06:02 -04:00
Open up /events to anonymous users for room events only
Squash-merge of PR #345 from daniel/anonymousevents
This commit is contained in:
parent
7a369e8a55
commit
ca2f90742d
20 changed files with 299 additions and 82 deletions
|
@ -47,7 +47,8 @@ class BaseHandler(object):
|
|||
self.event_builder_factory = hs.get_event_builder_factory()
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _filter_events_for_client(self, user_id, events, is_guest=False):
|
||||
def _filter_events_for_client(self, user_id, events, is_guest=False,
|
||||
require_all_visible_for_guests=True):
|
||||
# Assumes that user has at some point joined the room if not is_guest.
|
||||
|
||||
def allowed(event, membership, visibility):
|
||||
|
@ -100,7 +101,9 @@ class BaseHandler(object):
|
|||
if should_include:
|
||||
events_to_return.append(event)
|
||||
|
||||
if is_guest and len(events_to_return) < len(events):
|
||||
if (require_all_visible_for_guests
|
||||
and is_guest
|
||||
and len(events_to_return) < len(events)):
|
||||
# This indicates that some events in the requested range were not
|
||||
# visible to guest users. To be safe, we reject the entire request,
|
||||
# so that we don't have to worry about interpreting visibility
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue