From 72ae5c475039a7151d1ae6ec61d993b33ac693d5 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 2 Jul 2020 11:18:18 +0100 Subject: [PATCH] Fix tests --- clientapi/routing/createroom.go | 13 +++++++++++++ clientapi/routing/directory_public.go | 3 +++ currentstateserver/storage/tables/interface.go | 2 +- sytest-whitelist | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/clientapi/routing/createroom.go b/clientapi/routing/createroom.go index 42e1895ce..b6a5d1221 100644 --- a/clientapi/routing/createroom.go +++ b/clientapi/routing/createroom.go @@ -410,6 +410,19 @@ func createRoom( } } + if r.Visibility == "public" { + // expose this room in the published room list + var pubRes roomserverAPI.PerformPublishResponse + rsAPI.PerformPublish(req.Context(), &roomserverAPI.PerformPublishRequest{ + RoomID: roomID, + Visibility: "public", + }, &pubRes) + if pubRes.Error != nil { + // treat as non-fatal since the room is already made by this point + util.GetLogger(req.Context()).WithError(pubRes.Error).Error("failed to visibility:public") + } + } + response := createRoomResponse{ RoomID: roomID, RoomAlias: roomAlias, diff --git a/clientapi/routing/directory_public.go b/clientapi/routing/directory_public.go index c0c4cd930..7db0fa2c5 100644 --- a/clientapi/routing/directory_public.go +++ b/clientapi/routing/directory_public.go @@ -205,6 +205,9 @@ func publicRooms(ctx context.Context, request PublicRoomReq, rsAPI roomserverAPI var limit int16 var offset int64 limit = request.Limit + if limit == 0 { + limit = 50 + } offset, err := strconv.ParseInt(request.Since, 10, 64) // ParseInt returns 0 and an error when trying to parse an empty string // In that case, we want to assign 0 so we ignore the error diff --git a/currentstateserver/storage/tables/interface.go b/currentstateserver/storage/tables/interface.go index 4cd547ff7..8ba4e4eb9 100644 --- a/currentstateserver/storage/tables/interface.go +++ b/currentstateserver/storage/tables/interface.go @@ -64,7 +64,7 @@ func ExtractContentValue(ev *gomatrixserverlib.HeaderedEvent) string { case gomatrixserverlib.MRoomName: key = "name" case "m.room.avatar": - key = "avatar" + key = "url" case "m.room.topic": key = "topic" case "m.room.guest_access": diff --git a/sytest-whitelist b/sytest-whitelist index d055e75a2..3627c4db7 100644 --- a/sytest-whitelist +++ b/sytest-whitelist @@ -181,6 +181,8 @@ Outbound federation can query profile data /event/ on joined room works /event/ does not allow access to events before the user joined Federation key API allows unsigned requests for keys +GET /publicRooms lists rooms +GET /publicRooms includes avatar URLs Can paginate public room list GET /directory/room/:room_alias yields room ID PUT /directory/room/:room_alias creates alias