Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Aug 15, 2018
1 parent f5189b9 commit 0d5770d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
from twisted.internet.defer import succeed

from synapse.api.constants import MAX_DEPTH, EventTypes, Membership
from synapse.api.errors import AuthError, Codes, ConsentNotGivenError, SynapseError
from synapse.api.errors import (
AuthError,
Codes,
ConsentNotGivenError,
NotFoundError,
SynapseError,
)
from synapse.api.urls import ConsentURIBuilder
from synapse.crypto.event_signing import add_hashes_and_signatures
from synapse.events.utils import serialize_event
Expand Down Expand Up @@ -111,7 +117,7 @@ def get_state_events(
Returns:
A list of dicts representing state events. [{}, {}, {}]
Raises:
SynapseError (404) if the at token does not yield an event
NotFoundError (404) if the at token does not yield an event
AuthError (403) if the user doesn't have permission to view
members of this room.
Expand All @@ -126,14 +132,10 @@ def get_state_events(
)

if not last_events:
raise SynapseError(
404,
"Can't find event for token %s" % at_token,
Codes.NOT_FOUND
)
raise NotFoundError("Can't find event for token %s" % (at_token, ))

visible_events = yield filter_events_for_client(
self.store, user_id, last_events
self.store, user_id, last_events,
)

event = last_events[0]
Expand All @@ -144,14 +146,15 @@ def get_state_events(
room_state = room_state[event.event_id]
else:
raise AuthError(
403, "User %s not allowed to view events in room %s at token %s" % (
user_id, room_id, at_token
403,
"User %s not allowed to view events in room %s at token %s" % (
user_id, room_id, at_token,
)
)
else:
membership, membership_event_id = (
yield self.auth.check_in_room_or_world_readable(
room_id, user_id
room_id, user_id,
)
)

Expand Down

0 comments on commit 0d5770d

Please sign in to comment.