From 4731ae9c6d97b8914330dafff6df0531bab709ef Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Fri, 28 Jul 2017 11:22:38 +0100 Subject: [PATCH] Apply requested changes --- .../matrix-org/dendrite/clientapi/readers/directory.go | 8 +++----- .../dendrite/roomserver/storage/room_aliases_table.go | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go b/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go index 147a1c63d..4c25a45cd 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go +++ b/src/github.com/matrix-org/dendrite/clientapi/readers/directory.go @@ -27,10 +27,6 @@ import ( "github.com/matrix-org/util" ) -type roomID struct { - RoomID string `json:"room_id"` -} - // DirectoryRoom looks up a room alias func DirectoryRoom( req *http.Request, @@ -118,7 +114,9 @@ func SetLocalAlias( } } - var r roomID + var r struct { + RoomID string `json:"room_id"` + } if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil { return *resErr } diff --git a/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go b/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go index a060a1b50..8b56b6d14 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go +++ b/src/github.com/matrix-org/dendrite/roomserver/storage/room_aliases_table.go @@ -26,6 +26,8 @@ CREATE TABLE IF NOT EXISTS room_aliases ( -- Room ID the alias refers to room_id TEXT NOT NULL ); + +CREATE UNIQUE INDEX IF NOT EXISTS room_id_idx ON room_aliases(room_id); ` const insertRoomAliasSQL = "" +