From 313dd397f7ec863e1034908665af7b0f43dfc9b2 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Fri, 12 Jul 2019 10:14:39 +0100 Subject: [PATCH] Explain and condense end of SendMembership --- clientapi/routing/membership.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clientapi/routing/membership.go b/clientapi/routing/membership.go index c70f9dc98..22e66f452 100644 --- a/clientapi/routing/membership.go +++ b/clientapi/routing/membership.go @@ -99,18 +99,18 @@ func SendMembership( return httputil.LogThenError(req, err) } + var returnData interface{} = struct{}{} + + // The join membership requires the room id to be sent in the response if membership == "join" { - return util.JSONResponse{ - Code: http.StatusOK, - JSON: struct { - RoomID string `json:"room_id"` - }{roomID}, - } + returnData = struct { + RoomID string `json:"room_id"` + }{roomID} } return util.JSONResponse{ Code: http.StatusOK, - JSON: struct{}{}, + JSON: returnData, } }