AccountsUpdate: Provide AccountState instead of Account for account updates

Some callers need access to the external IDs in order to decide which
account updates should be done. At the moment these callers first read
the external IDs and then read and update the account. This way there is
a risk of a race that the external IDs are updated after they have been
read and before the account is read and updated. By providing an
AccountState that was consistently read for the account updates callers
have access to both the account and the external IDs (and also general
preferences and project watches). Adapting the callers to take advantage
of the provided AccountState will be done in a follow-up change.

Change-Id: Ia2bcd7df61bd8450e9f228afd01ffe7836a3270a
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-01-09 17:22:21 +01:00
parent 8f9793676d
commit faf942807a
8 changed files with 70 additions and 26 deletions

View File

@@ -2987,7 +2987,7 @@ class ReceiveCommits {
"Set Full Name on Receive Commits",
user.getAccountId(),
(a, u) -> {
if (Strings.isNullOrEmpty(a.getFullName())) {
if (Strings.isNullOrEmpty(a.getAccount().getFullName())) {
u.setFullName(setFullNameTo);
}
});