Persisting users diff formatting preferences
When a user changes diff formatting preferences and clicks the Update button the preferences will then be persisted in the database. This way a user doesn't have to adjust the diff formatting preferences each time it switches to the next file diff. Bug: issue 579 Change-Id: I52cd1dcf702ed04046b236228f994fb9042243d9 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:
committed by
Shawn O. Pearce
parent
5a00b3161d
commit
077b2c5dd0
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.server;
|
||||
|
||||
import com.google.gerrit.reviewdb.Account;
|
||||
import com.google.gerrit.reviewdb.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.AccountProjectWatch;
|
||||
import com.google.gerrit.reviewdb.Change;
|
||||
@@ -178,6 +179,20 @@ public class IdentifiedUser extends CurrentUser {
|
||||
return state().getAccount();
|
||||
}
|
||||
|
||||
public AccountDiffPreference getAccountDiffPreference() {
|
||||
AccountDiffPreference diffPref;
|
||||
try {
|
||||
diffPref = dbProvider.get().accountDiffPreferences().get(getAccountId());
|
||||
if (diffPref == null) {
|
||||
diffPref = AccountDiffPreference.createDefault(getAccountId());
|
||||
}
|
||||
} catch (OrmException e) {
|
||||
log.warn("Cannot query account diff preferences", e);
|
||||
diffPref = AccountDiffPreference.createDefault(getAccountId());
|
||||
}
|
||||
return diffPref;
|
||||
}
|
||||
|
||||
public Set<String> getEmailAddresses() {
|
||||
if (emailAddresses == null) {
|
||||
emailAddresses = state().getEmailAddresses();
|
||||
|
||||
Reference in New Issue
Block a user