mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
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]
This commit is contained in:
parent
1432743d1a
commit
6b47cf0f6a
22 changed files with 469 additions and 903 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue