Fix wrong date/time for commits in refs/users/XX/YYYY branches
When the refs/users/XX/YYYY branch of a user is modified using the SetPreferences REST endpoint (e.g. when changing the 'My' menu preferences) the commit date/time is wrong. Instead of the actual date/time the date/time of the last Gerrit server start is used. This is because MetaDataUpdate.User which gets the GerritPersonIdent injected is kept as member in the SetPreferences singleton and the date/time for commits in the refs/users/XX/YYYY branches is retrieved from that GerritPersonIdent instance which is only created once when the SetPreferences singleton is instantiated. Change-Id: Idbf46185ea9ff58742b84fc7068727c6a1469a2e Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -80,7 +80,7 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
||||
private final Provider<CurrentUser> self;
|
||||
private final AccountCache cache;
|
||||
private final Provider<ReviewDb> db;
|
||||
private final MetaDataUpdate.User metaDataUpdateFactory;
|
||||
private final Provider<MetaDataUpdate.User> metaDataUpdateFactory;
|
||||
private final AllUsersName allUsersName;
|
||||
private final DynamicMap<DownloadScheme> downloadSchemes;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
||||
SetPreferences(Provider<CurrentUser> self,
|
||||
AccountCache cache,
|
||||
Provider<ReviewDb> db,
|
||||
MetaDataUpdate.User metaDataUpdateFactory,
|
||||
Provider<MetaDataUpdate.User> metaDataUpdateFactory,
|
||||
AllUsersName allUsersName,
|
||||
DynamicMap<DownloadScheme> downloadSchemes) {
|
||||
this.self = self;
|
||||
@@ -114,7 +114,7 @@ public class SetPreferences implements RestModifyView<AccountResource, Input> {
|
||||
Account.Id accountId = rsrc.getUser().getAccountId();
|
||||
AccountGeneralPreferences p;
|
||||
VersionedAccountPreferences versionedPrefs;
|
||||
MetaDataUpdate md = metaDataUpdateFactory.create(allUsersName);
|
||||
MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName);
|
||||
db.get().accounts().beginTransaction(accountId);
|
||||
try {
|
||||
Account a = db.get().accounts().get(accountId);
|
||||
|
Reference in New Issue
Block a user