From 8f2153d3e659d3c06fc0cec22341dc1155db2f6d Mon Sep 17 00:00:00 2001 From: Sam Wedgwood Date: Thu, 27 Jul 2023 12:11:16 +0100 Subject: [PATCH] lint pass - handled unhandled err in RemoveLocalAlias - removed unused argument from moveLocalAliases --- clientapi/routing/directory.go | 9 ++++++++- roomserver/internal/perform/perform_upgrade.go | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/clientapi/routing/directory.go b/clientapi/routing/directory.go index d5bd2f385..b9dddb6d8 100644 --- a/clientapi/routing/directory.go +++ b/clientapi/routing/directory.go @@ -274,10 +274,17 @@ func RemoveLocalAlias( // as meaning they are not in the room, since lacking a sender ID could be caused by other bugs. // TODO: maybe have QuerySenderIDForUser return richer errors? var queryResp roomserverAPI.QueryMembershipForUserResponse - rsAPI.QueryMembershipForUser(req.Context(), &roomserverAPI.QueryMembershipForUserRequest{ + err = rsAPI.QueryMembershipForUser(req.Context(), &roomserverAPI.QueryMembershipForUserRequest{ RoomID: validRoomID.String(), UserID: *userID, }, &queryResp) + if err != nil { + util.GetLogger(req.Context()).WithError(err).Error("roomserverAPI.QueryMembershipForUser failed") + return util.JSONResponse{ + Code: http.StatusInternalServerError, + JSON: spec.Unknown("internal server error"), + } + } if !queryResp.IsInRoom { return util.JSONResponse{ Code: http.StatusForbidden, diff --git a/roomserver/internal/perform/perform_upgrade.go b/roomserver/internal/perform/perform_upgrade.go index ff0464c58..2e16e1685 100644 --- a/roomserver/internal/perform/perform_upgrade.go +++ b/roomserver/internal/perform/perform_upgrade.go @@ -116,7 +116,7 @@ func (r *Upgrader) performRoomUpgrade( } // 4. Move local aliases to the new room - if pErr = moveLocalAliases(ctx, roomID, newRoomID, senderID, userID, r.URSAPI); pErr != nil { + if pErr = moveLocalAliases(ctx, roomID, newRoomID, senderID, r.URSAPI); pErr != nil { return "", pErr } @@ -171,7 +171,7 @@ func (r *Upgrader) restrictOldRoomPowerLevels(ctx context.Context, evTime time.T } func moveLocalAliases(ctx context.Context, - roomID, newRoomID string, senderID spec.SenderID, userID spec.UserID, + roomID, newRoomID string, senderID spec.SenderID, URSAPI api.RoomserverInternalAPI, ) (err error) {