aboutsummaryrefslogtreecommitdiff
path: root/userapi
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-04-28 17:46:01 +0200
committerGitHub <noreply@github.com>2023-04-28 17:46:01 +0200
commit6b47cf0f6ac9176b7e5a5bd6f357722ee0f5e384 (patch)
tree484c0133034ec1968e66d69b58c4f90486b1c5ae /userapi
parent1432743d1ad669718e8f70f4dc1f29a9762e3fc4 (diff)
Remove `PerformError` (#3066)
This removes `PerformError`, which was needed when we still had polylith. This removes quite a bunch of ```go if err != nil { return err } if err := res.Error; err != nil { return err.JSONResponse() } ``` Hopefully can be read commit by commit. [skip ci]
Diffstat (limited to 'userapi')
-rw-r--r--userapi/internal/user_api.go23
1 files changed, 9 insertions, 14 deletions
diff --git a/userapi/internal/user_api.go b/userapi/internal/user_api.go
index 1b6a4ebf..cdd08344 100644
--- a/userapi/internal/user_api.go
+++ b/userapi/internal/user_api.go
@@ -172,8 +172,8 @@ func addUserToRoom(
UserID: userID,
Content: addGroupContent,
}
- joinRes := rsapi.PerformJoinResponse{}
- return rsAPI.PerformJoin(ctx, &joinReq, &joinRes)
+ _, _, err := rsAPI.PerformJoin(ctx, &joinReq)
+ return err
}
func (a *UserInternalAPI) PerformAccountCreation(ctx context.Context, req *api.PerformAccountCreationRequest, res *api.PerformAccountCreationResponse) error {
@@ -624,33 +624,28 @@ func (a *UserInternalAPI) PerformAccountDeactivation(ctx context.Context, req *a
return fmt.Errorf("server name %q not locally configured", serverName)
}
- evacuateReq := &rsapi.PerformAdminEvacuateUserRequest{
- UserID: fmt.Sprintf("@%s:%s", req.Localpart, serverName),
- }
- evacuateRes := &rsapi.PerformAdminEvacuateUserResponse{}
- if err := a.RSAPI.PerformAdminEvacuateUser(ctx, evacuateReq, evacuateRes); err != nil {
- return err
- }
- if err := evacuateRes.Error; err != nil {
- logrus.WithError(err).Errorf("Failed to evacuate user after account deactivation")
+ userID := fmt.Sprintf("@%s:%s", req.Localpart, serverName)
+ _, err := a.RSAPI.PerformAdminEvacuateUser(ctx, userID)
+ if err != nil {
+ logrus.WithError(err).WithField("userID", userID).Errorf("Failed to evacuate user after account deactivation")
}
deviceReq := &api.PerformDeviceDeletionRequest{
UserID: fmt.Sprintf("@%s:%s", req.Localpart, serverName),
}
deviceRes := &api.PerformDeviceDeletionResponse{}
- if err := a.PerformDeviceDeletion(ctx, deviceReq, deviceRes); err != nil {
+ if err = a.PerformDeviceDeletion(ctx, deviceReq, deviceRes); err != nil {
return err
}
pusherReq := &api.PerformPusherDeletionRequest{
Localpart: req.Localpart,
}
- if err := a.PerformPusherDeletion(ctx, pusherReq, &struct{}{}); err != nil {
+ if err = a.PerformPusherDeletion(ctx, pusherReq, &struct{}{}); err != nil {
return err
}
- err := a.DB.DeactivateAccount(ctx, req.Localpart, serverName)
+ err = a.DB.DeactivateAccount(ctx, req.Localpart, serverName)
res.AccountDeactivated = err == nil
return err
}