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

Commit c8665dd

Browse files
authored
Remove the unspecced and bugged PUT /knock/{roomIdOrAlias} endpoint (#15189)
1 parent c4f4dc3 commit c8665dd

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

changelog.d/15189.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the unspecced `PUT` on the `/knock/{roomIdOrAlias}` endpoint.

synapse/rest/client/knock.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
import logging
16-
from typing import TYPE_CHECKING, Awaitable, Dict, List, Optional, Tuple
16+
from typing import TYPE_CHECKING, Dict, List, Tuple
1717

1818
from synapse.api.constants import Membership
1919
from synapse.api.errors import SynapseError
@@ -24,8 +24,6 @@
2424
parse_strings_from_args,
2525
)
2626
from synapse.http.site import SynapseRequest
27-
from synapse.logging.opentracing import set_tag
28-
from synapse.rest.client.transactions import HttpTransactionCache
2927
from synapse.types import JsonDict, RoomAlias, RoomID
3028

3129
if TYPE_CHECKING:
@@ -45,15 +43,13 @@ class KnockRoomAliasServlet(RestServlet):
4543

4644
def __init__(self, hs: "HomeServer"):
4745
super().__init__()
48-
self.txns = HttpTransactionCache(hs)
4946
self.room_member_handler = hs.get_room_member_handler()
5047
self.auth = hs.get_auth()
5148

5249
async def on_POST(
5350
self,
5451
request: SynapseRequest,
5552
room_identifier: str,
56-
txn_id: Optional[str] = None,
5753
) -> Tuple[int, JsonDict]:
5854
requester = await self.auth.get_user_by_req(request)
5955

@@ -86,23 +82,13 @@ async def on_POST(
8682
target=requester.user,
8783
room_id=room_id,
8884
action=Membership.KNOCK,
89-
txn_id=txn_id,
9085
third_party_signed=None,
9186
remote_room_hosts=remote_room_hosts,
9287
content=event_content,
9388
)
9489

9590
return 200, {"room_id": room_id}
9691

97-
def on_PUT(
98-
self, request: SynapseRequest, room_identifier: str, txn_id: str
99-
) -> Awaitable[Tuple[int, JsonDict]]:
100-
set_tag("txn_id", txn_id)
101-
102-
return self.txns.fetch_or_execute_request(
103-
request, self.on_POST, request, room_identifier, txn_id
104-
)
105-
10692

10793
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
10894
KnockRoomAliasServlet(hs).register(http_server)

0 commit comments

Comments
 (0)