Create a user branch for every account
Make sure that for every account a user branch exists that has an initial empty commit with the registration date as commit time. The commit timestamp of the first commit on a user branch will be used as registration timestamp when accounts are stored in NoteDb. When an account is created create the user branch with an initial empty commit that has the registration date as commit time. For existing accounts add a schema migration that: - creates the user branch with an initial empty commit that has the registration date as commit time if the user branch doesn't exist yet - rewrites the user branch if it already exists and inserts an initial empty commit with the registration date as commit time (if such a commit doesn't exist yet). Change-Id: I81491a253350a43f094fdfcb32298efde0cb086a Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -53,7 +53,7 @@ public class AccountCreator {
|
||||
private final Map<String, TestAccount> accounts;
|
||||
|
||||
private final SchemaFactory<ReviewDb> reviewDbProvider;
|
||||
private final AccountsUpdate accountsUpdate;
|
||||
private final AccountsUpdate.Server accountsUpdate;
|
||||
private final VersionedAuthorizedKeys.Accessor authorizedKeys;
|
||||
private final GroupCache groupCache;
|
||||
private final SshKeyCache sshKeyCache;
|
||||
@@ -65,7 +65,7 @@ public class AccountCreator {
|
||||
@Inject
|
||||
AccountCreator(
|
||||
SchemaFactory<ReviewDb> schema,
|
||||
AccountsUpdate accountsUpdate,
|
||||
AccountsUpdate.Server accountsUpdate,
|
||||
VersionedAuthorizedKeys.Accessor authorizedKeys,
|
||||
GroupCache groupCache,
|
||||
SshKeyCache sshKeyCache,
|
||||
@@ -114,7 +114,7 @@ public class AccountCreator {
|
||||
Account a = new Account(id, TimeUtil.nowTs());
|
||||
a.setFullName(fullName);
|
||||
a.setPreferredEmail(email);
|
||||
accountsUpdate.insert(db, a);
|
||||
accountsUpdate.create().insert(db, a);
|
||||
|
||||
if (groups != null) {
|
||||
for (String n : groups) {
|
||||
|
||||
Reference in New Issue
Block a user