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

Commit

Permalink
FIXUP: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoric committed Jan 28, 2021
1 parent 93f84e0 commit 31d072a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
create_requester,
)
from synapse.util import stringutils
from synapse.util.async_helpers import Linearizer, maybe_awaitable
from synapse.util.async_helpers import Linearizer
from synapse.util.caches.response_cache import ResponseCache
from synapse.util.stringutils import parse_and_validate_server_name
from synapse.visibility import filter_events_for_client
Expand Down
5 changes: 5 additions & 0 deletions synapse/rest/admin/rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
import logging
from http import HTTPStatus
from typing import TYPE_CHECKING, List, Optional, Tuple
from urllib import parse as urlparse

from synapse.api.constants import EventTypes, JoinRules, Membership
from synapse.api.errors import AuthError, Codes, NotFoundError, SynapseError
from synapse.api.filtering import Filter
from synapse.http.servlet import (
RestServlet,
assert_params_in_dict,
Expand All @@ -33,6 +35,7 @@
)
from synapse.storage.databases.main.room import RoomSortOrder
from synapse.types import JsonDict, RoomAlias, RoomID, UserID, create_requester
from synapse.util import json_decoder

if TYPE_CHECKING:
from synapse.server import HomeServer
Expand Down Expand Up @@ -567,13 +570,15 @@ async def on_GET(self, request, room_identifier):
extremities = await self.store.get_forward_extremities_for_room(room_id)
return 200, {"count": len(extremities), "results": extremities}


class RoomEventContextServlet(RestServlet):
"""
Provide the context for an event.
This API is designed to be used when system administrators wish to look at
an abuse report and understand what happened during and immediately prior
to this event.
"""

PATTERNS = admin_patterns("/rooms/(?P<room_id>[^/]*)/context/(?P<event_id>[^/]*)$")

def __init__(self, hs):
Expand Down
4 changes: 3 additions & 1 deletion tests/rest/admin/test_room.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,9 @@ def test_context_as_non_admin(self):
% (room_id, events[midway]["event_id"]),
access_token=tok,
)
self.assertEquals(403, int(channel.result["code"]), msg=channel.result["body"])
self.assertEquals(
403, int(channel.result["code"]), msg=channel.result["body"]
)
self.assertEqual(Codes.FORBIDDEN, channel.json_body["errcode"])

def test_context_as_admin(self):
Expand Down

0 comments on commit 31d072a

Please sign in to comment.