mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Remove device DB from clientapi (#1352)
* Remove device DB from clientapi * Remove device DB from startup configuration It's all an impl detail now in user API
This commit is contained in:
parent
c0f28845f8
commit
9af2f5f1f2
22 changed files with 109 additions and 118 deletions
|
@ -123,12 +123,21 @@ func (a *UserInternalAPI) PerformDeviceDeletion(ctx context.Context, req *api.Pe
|
|||
if domain != a.ServerName {
|
||||
return fmt.Errorf("cannot PerformDeviceDeletion of remote users: got %s want %s", domain, a.ServerName)
|
||||
}
|
||||
err = a.DeviceDB.RemoveDevices(ctx, local, req.DeviceIDs)
|
||||
deletedDeviceIDs := req.DeviceIDs
|
||||
if len(req.DeviceIDs) == 0 {
|
||||
var devices []api.Device
|
||||
devices, err = a.DeviceDB.RemoveAllDevices(ctx, local)
|
||||
for _, d := range devices {
|
||||
deletedDeviceIDs = append(deletedDeviceIDs, d.ID)
|
||||
}
|
||||
} else {
|
||||
err = a.DeviceDB.RemoveDevices(ctx, local, req.DeviceIDs)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// create empty device keys and upload them to delete what was once there and trigger device list changes
|
||||
return a.deviceListUpdate(req.UserID, req.DeviceIDs)
|
||||
return a.deviceListUpdate(req.UserID, deletedDeviceIDs)
|
||||
}
|
||||
|
||||
func (a *UserInternalAPI) deviceListUpdate(userID string, deviceIDs []string) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue