diff options
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/presence.py | 12 | ||||
-rw-r--r-- | synapse/rest/events.py | 2 | ||||
-rw-r--r-- | synapse/rest/room.py | 12 |
3 files changed, 14 insertions, 12 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index f0d7b34682..e8cb83eddb 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -155,7 +155,10 @@ class PresenceHandler(BaseHandler): if allowed_by_subscription: defer.returnValue(True) - # TODO(paul): Check same channel + rm_handler = self.homeserver.get_handlers().room_member_handler + for room_id in (yield rm_handler.get_rooms_for_user(observer_user)): + if observed_user in (yield rm_handler.get_room_members(room_id)): + defer.returnValue(True) defer.returnValue(False) @@ -166,16 +169,11 @@ class PresenceHandler(BaseHandler): observed_user=target_user ) - if visible or True: # XXX: FIXME: Bodge to unbreak matrix.org. breaks UTs. + if visible: state = yield self.store.get_presence_state( target_user.localpart ) else: - # FIXME: *Surely* we shouldn't be 404ing the whole request, whatever - # it is, just because presence info isn't visible?! - # This causes client/api/v1/rooms/!cURbafjkfsMDVwdRDQ%3Amatrix.org/members/list - # to 404 currently - raise SynapseError(404, "Presence information not visible") else: # TODO(paul): Have remote server send us permissions set diff --git a/synapse/rest/events.py b/synapse/rest/events.py index dc811b813a..ca2f6978e5 100644 --- a/synapse/rest/events.py +++ b/synapse/rest/events.py @@ -24,7 +24,7 @@ from synapse.rest.base import RestServlet, client_path_pattern class EventStreamRestServlet(RestServlet): PATTERN = client_path_pattern("/events$") - DEFAULT_LONGPOLL_TIME_MS = 5000 + DEFAULT_LONGPOLL_TIME_MS = 30000 @defer.inlineCallbacks def on_GET(self, request): diff --git a/synapse/rest/room.py b/synapse/rest/room.py index fe0953c69d..dfb2aabe70 100644 --- a/synapse/rest/room.py +++ b/synapse/rest/room.py @@ -353,10 +353,14 @@ class RoomMemberListRestServlet(RestServlet): for event in members["chunk"]: target_user = self.hs.parse_userid(event["target_user_id"]) - presence_state = yield self.handlers.presence_handler.get_state( - target_user=target_user, auth_user=user - ) - event["content"].update(presence_state) + # Presence is an optional cache; don't fail if we can't fetch it + try: + presence_state = yield self.handlers.presence_handler.get_state( + target_user=target_user, auth_user=user + ) + event["content"].update(presence_state) + except: + pass defer.returnValue((200, members)) |