mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
Fix more E2E sytests (#1265)
* WIP: Eagerly sync device lists on /user/keys/query requests Also notify servers when a user's device display name changes. Few caveats: - sytest `Device deletion propagates over federation` fails - `populateResponseWithDeviceKeysFromDatabase` is called from multiple goroutines and hence is unsafe. * Handle deleted devices correctly over federation
This commit is contained in:
parent
d98ec12422
commit
820c56c165
11 changed files with 197 additions and 27 deletions
|
@ -180,6 +180,27 @@ func (a *UserInternalAPI) PerformDeviceUpdate(ctx context.Context, req *api.Perf
|
|||
util.GetLogger(ctx).WithError(err).Error("deviceDB.UpdateDevice failed")
|
||||
return err
|
||||
}
|
||||
if req.DisplayName != nil && dev.DisplayName != *req.DisplayName {
|
||||
// display name has changed: update the device key
|
||||
var uploadRes keyapi.PerformUploadKeysResponse
|
||||
a.KeyAPI.PerformUploadKeys(context.Background(), &keyapi.PerformUploadKeysRequest{
|
||||
DeviceKeys: []keyapi.DeviceKeys{
|
||||
{
|
||||
DeviceID: dev.ID,
|
||||
DisplayName: *req.DisplayName,
|
||||
KeyJSON: nil,
|
||||
UserID: dev.UserID,
|
||||
},
|
||||
},
|
||||
OnlyDisplayNameUpdates: true,
|
||||
}, &uploadRes)
|
||||
if uploadRes.Error != nil {
|
||||
return fmt.Errorf("Failed to update device key display name: %v", uploadRes.Error)
|
||||
}
|
||||
if len(uploadRes.KeyErrors) > 0 {
|
||||
return fmt.Errorf("Failed to update device key display name, key errors: %+v", uploadRes.KeyErrors)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue