KeysController: return correct number of unsigned prekeys
When GET /v2/keys was orignally added inb263f47
, prekeys were stored in Postgres, with a user's unsigned and signed keys together in the same table. Therefore GET /v2/keys subtracted one from the count returned by storage. Ind4d9403
, we changed to a different storage schema, with unsigned prekeys in one DynamoDB table and unsigned prekeys in the accounts Dynamo table. Unfortunately, GET /v2/keys was not changed to stop subtracting one from the count of prekeys in the keys table at the same time. This commit fixes that.
This commit is contained in:
parent
781cd0ca3f
commit
391b070cff
|
@ -79,10 +79,6 @@ public class KeysController {
|
||||||
|
|
||||||
int count = keys.getCount(getIdentifier(auth.getAccount(), identityType), auth.getAuthenticatedDevice().getId());
|
int count = keys.getCount(getIdentifier(auth.getAccount(), identityType), auth.getAuthenticatedDevice().getId());
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
count = count - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new PreKeyCount(count);
|
return new PreKeyCount(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ class KeysControllerTest {
|
||||||
AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD))
|
AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD))
|
||||||
.get(PreKeyCount.class);
|
.get(PreKeyCount.class);
|
||||||
|
|
||||||
assertThat(result.getCount()).isEqualTo(4);
|
assertThat(result.getCount()).isEqualTo(5);
|
||||||
|
|
||||||
verify(KEYS).getCount(AuthHelper.VALID_UUID, 1);
|
verify(KEYS).getCount(AuthHelper.VALID_UUID, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue