Clean up user devices when deactivating

This commit is contained in:
Neil Alexander 2022-06-29 13:55:30 +01:00
parent cf8716ef81
commit 25c0477dd1
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -460,6 +460,14 @@ func (a *UserInternalAPI) PerformAccountDeactivation(ctx context.Context, req *a
evacuateRes := &rsapi.PerformAdminEvacuateUserResponse{}
a.RSAPI.PerformAdminEvacuateUser(ctx, evacuateReq, evacuateRes)
if err := evacuateRes.Error; err != nil {
logrus.WithError(err).Errorf("Failed to evacuate user after account deactivation")
}
deviceReq := &api.PerformDeviceDeletionRequest{
UserID: fmt.Sprintf("@%s:%s", req.Localpart, a.ServerName),
}
deviceRes := &api.PerformDeviceDeletionResponse{}
if err := a.PerformDeviceDeletion(ctx, deviceReq, deviceRes); err != nil {
return err
}