Make user preferences accessible by plugins

Add methods to the JavaScript API that allows plugins to get and
refresh the preferences of the currently signed in user.

Change-Id: Icabaf8188ccdd19b877856a23d292493cd50a215
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-07-22 15:01:59 +02:00
parent ebbad5ecab
commit 936d1ed8d1
8 changed files with 115 additions and 74 deletions

View File

@@ -30,9 +30,6 @@ public class AccountPreferencesInfo extends JavaScriptObject {
public static AccountPreferencesInfo create(AccountGeneralPreferences in,
List<TopMenuItem> myMenus) {
AccountPreferencesInfo p = createObject().cast();
if (in == null) {
in = AccountGeneralPreferences.createDefault();
}
p.changesPerPage(in.getMaximumPageSize());
p.showSiteHeader(in.isShowSiteHeader());
p.useFlashClipboard(in.isUseFlashClipboard());
@@ -47,10 +44,16 @@ public class AccountPreferencesInfo extends JavaScriptObject {
p.muteCommonPathPrefixes(in.isMuteCommonPathPrefixes());
p.reviewCategoryStrategy(in.getReviewCategoryStrategy());
p.diffView(in.getDiffView());
p.setMyMenus(myMenus);
if (myMenus != null) {
p.setMyMenus(myMenus);
}
return p;
}
public static AccountPreferencesInfo createDefault() {
return create(AccountGeneralPreferences.createDefault(), null);
}
public final short changesPerPage() {
return get("changes_per_page", AccountGeneralPreferences.DEFAULT_PAGESIZE);
}