Merge pull request #361 from matrix-org/daniel/guestcontext
Allow guests to access room context API
This commit is contained in:
commit
04034d0b56
|
@ -765,7 +765,7 @@ class RoomListHandler(BaseHandler):
|
|||
|
||||
class RoomContextHandler(BaseHandler):
|
||||
@defer.inlineCallbacks
|
||||
def get_event_context(self, user, room_id, event_id, limit):
|
||||
def get_event_context(self, user, room_id, event_id, limit, is_guest):
|
||||
"""Retrieves events, pagination tokens and state around a given event
|
||||
in a room.
|
||||
|
||||
|
@ -789,11 +789,17 @@ class RoomContextHandler(BaseHandler):
|
|||
)
|
||||
|
||||
results["events_before"] = yield self._filter_events_for_client(
|
||||
user.to_string(), results["events_before"]
|
||||
user.to_string(),
|
||||
results["events_before"],
|
||||
is_guest=is_guest,
|
||||
require_all_visible_for_guests=False
|
||||
)
|
||||
|
||||
results["events_after"] = yield self._filter_events_for_client(
|
||||
user.to_string(), results["events_after"]
|
||||
user.to_string(),
|
||||
results["events_after"],
|
||||
is_guest=is_guest,
|
||||
require_all_visible_for_guests=False
|
||||
)
|
||||
|
||||
if results["events_after"]:
|
||||
|
|
|
@ -417,12 +417,12 @@ class RoomEventContext(ClientV1RestServlet):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def on_GET(self, request, room_id, event_id):
|
||||
user, _ = yield self.auth.get_user_by_req(request)
|
||||
user, _, is_guest = yield self.auth.get_user_by_req(request, allow_guest=True)
|
||||
|
||||
limit = int(request.args.get("limit", [10])[0])
|
||||
|
||||
results = yield self.handlers.room_context_handler.get_event_context(
|
||||
user, room_id, event_id, limit,
|
||||
user, room_id, event_id, limit, is_guest
|
||||
)
|
||||
|
||||
time_now = self.clock.time_msec()
|
||||
|
|
Loading…
Reference in New Issue