Page MenuHomePhabricator

Create user preference repository
Closed, ResolvedPublic

Description

Vuex store:

  • maintains a list of preferences
  • has a USER_PREFERENCES_INIT action initializing all values
  • has a USER_PREFERENCE_SET action that sets an individual preference value
  • preferences is part of the user module state, a map of preference keys to values

DispatchingUserPreferenceRepository

  • maintains a mapping of preferences to data sources and their configuration
    • preferences are identified by a name
    • preference persistence can be configured: currently the only way of doing so is via cookie
    • exposes method(s) used by vuex user preference store actions
    • is used during application initialization to set the vuex state accordingly
  • cookie for our feature "wikibase-no-anonymouseditwarning"

Info:

  • mw.cookie is an existing service to set and get cookies
  • the current properties of the user state (name, primaryLanguage, secondaryLanguages) are not part of the preferences

We imagine something like the following to be the mapping of the DispatchingUserPreferenceRepository:

{
  'ignoreAnonWarning': new CookieUserPreferenceRepository( { ttl: 5000, cookieName: 'anon-warning-pref' }),
  'licenceWarning': new FallbackUserPreferenceRepository( new CookieUserPreferenceRepository( ... ), new MWUserSettingPreferenceRepository( ... ) ),
  ...
}

Event Timeline

Change 512719 had a related patch set uploaded (by Jakob; owner: Jakob):
[wikibase/termbox@master] User preferences: vuex store and repository

https://gerrit.wikimedia.org/r/512719

Change 512719 merged by jenkins-bot:
[wikibase/termbox@master] User preferences: store bindings and repositories

https://gerrit.wikimedia.org/r/512719