mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-05 07:32:46 +00:00
Fix failing tests
This commit is contained in:
parent
937f72b250
commit
66b65fdd27
9 changed files with 46 additions and 21 deletions
|
@ -358,8 +358,11 @@ func (a *UserInternalAPI) QueryAccountData(ctx context.Context, req *api.QueryAc
|
|||
func (a *UserInternalAPI) QueryAccessToken(ctx context.Context, req *api.QueryAccessTokenRequest, res *api.QueryAccessTokenResponse) error {
|
||||
if req.AppServiceUserID != "" {
|
||||
appServiceDevice, err := a.queryAppServiceToken(ctx, req.AccessToken, req.AppServiceUserID)
|
||||
if err != nil {
|
||||
res.Err = err.Error()
|
||||
}
|
||||
res.Device = appServiceDevice
|
||||
res.Err = err
|
||||
|
||||
return nil
|
||||
}
|
||||
device, err := a.DeviceDB.GetDeviceByAccessToken(ctx, req.AccessToken)
|
||||
|
@ -455,13 +458,16 @@ func (a *UserInternalAPI) QueryOpenIDToken(ctx context.Context, req *api.QueryOp
|
|||
return nil
|
||||
}
|
||||
|
||||
func (a *UserInternalAPI) PerformKeyBackup(ctx context.Context, req *api.PerformKeyBackupRequest, res *api.PerformKeyBackupResponse) {
|
||||
func (a *UserInternalAPI) PerformKeyBackup(ctx context.Context, req *api.PerformKeyBackupRequest, res *api.PerformKeyBackupResponse) error {
|
||||
// Delete metadata
|
||||
if req.DeleteBackup {
|
||||
if req.Version == "" {
|
||||
res.BadInput = true
|
||||
res.Error = "must specify a version to delete"
|
||||
return
|
||||
if res.Error != "" {
|
||||
return fmt.Errorf(res.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
exists, err := a.AccountDB.DeleteKeyBackup(ctx, req.UserID, req.Version)
|
||||
if err != nil {
|
||||
|
@ -469,7 +475,10 @@ func (a *UserInternalAPI) PerformKeyBackup(ctx context.Context, req *api.Perform
|
|||
}
|
||||
res.Exists = exists
|
||||
res.Version = req.Version
|
||||
return
|
||||
if res.Error != "" {
|
||||
return fmt.Errorf(res.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// Create metadata
|
||||
if req.Version == "" {
|
||||
|
@ -479,7 +488,10 @@ func (a *UserInternalAPI) PerformKeyBackup(ctx context.Context, req *api.Perform
|
|||
}
|
||||
res.Exists = err == nil
|
||||
res.Version = version
|
||||
return
|
||||
if res.Error != "" {
|
||||
return fmt.Errorf(res.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// Update metadata
|
||||
if len(req.Keys.Rooms) == 0 {
|
||||
|
@ -489,10 +501,17 @@ func (a *UserInternalAPI) PerformKeyBackup(ctx context.Context, req *api.Perform
|
|||
}
|
||||
res.Exists = err == nil
|
||||
res.Version = req.Version
|
||||
return
|
||||
if res.Error != "" {
|
||||
return fmt.Errorf(res.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// Upload Keys for a specific version metadata
|
||||
a.uploadBackupKeys(ctx, req, res)
|
||||
if res.Error != "" {
|
||||
return fmt.Errorf(res.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *UserInternalAPI) uploadBackupKeys(ctx context.Context, req *api.PerformKeyBackupRequest, res *api.PerformKeyBackupResponse) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue