From 7813b019fda594a42cde0d869ab2b789301573b8 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 11 Jul 2019 16:34:59 +0100 Subject: [PATCH] Clean up code a bit --- clientapi/routing/membership.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/clientapi/routing/membership.go b/clientapi/routing/membership.go index cd439be71..c70f9dc98 100644 --- a/clientapi/routing/membership.go +++ b/clientapi/routing/membership.go @@ -58,12 +58,12 @@ func SendMembership( } } - inviteStored, errRes := checkAndProcessThreepid( + inviteStored, jsonErrResp := checkAndProcessThreepid( req, device, &body, cfg, queryAPI, accountDB, producer, membership, roomID, evTime, ) - if errRes != nil { - return *errRes + if jsonErrResp != nil { + return *jsonErrResp } // If an invite has been stored on an identity server, it means that a @@ -211,9 +211,15 @@ func getMembershipStateKey( } func checkAndProcessThreepid( - req *http.Request, device *authtypes.Device, body *threepid.MembershipRequest, - cfg config.Dendrite, queryAPI roomserverAPI.RoomserverQueryAPI, accountDB *accounts.Database, - producer *producers.RoomserverProducer, membership string, roomID string, evTime time.Time, + req *http.Request, + device *authtypes.Device, + body *threepid.MembershipRequest, + cfg config.Dendrite, + queryAPI roomserverAPI.RoomserverQueryAPI, + accountDB *accounts.Database, + producer *producers.RoomserverProducer, + membership, roomID string, + evTime time.Time, ) (inviteStored bool, errRes *util.JSONResponse) { inviteStored, err := threepid.CheckAndProcessInvite(