Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-10853

Some static lists in XWiki.XWikiPreferences have the "---" value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 10.8.1, 10.9
    • 6.2-milestone-2
    • Old Core
    • None
    • Unknown
    • N/A
    • N/A

    Description

      In XWiki.XWikiPreferencesInitalizer ( https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/mandatory/XWikiPreferencesDocumentInitializer.java#L106 ), we have some lines like this:

      needsUpdate |= bclass.addStaticListField("editor", "Default Editor", "---|Text|Wysiwyg");
      needsUpdate |= bclass.addStaticListField("registration_anonymous", "Anonymous", "---|Image|Text");
      needsUpdate |= bclass.addStaticListField("leftPanelsWidth", "Width of the left panel column",
                      "---|Small|Medium|Large");
      

      The problem is that the value "--- " should not be stored in the db, since it means "default". Instead, the default should be the empty value with a displayer to show "--- " in the UI.

      The problem is that xwiki.getSpacePreference() does not fallback to xwiki.getWikiPreference() when the value is "--- ", because it currently only fallback on empty value (ex: XWIKI-10787).

      Different fixes are possibles:

      1. change XWiki.XWikiPreferences to not store "--- " anymore with either a migrator to remove the current "--- " values or either a fallback on xwiki.getSpacePreference() when the value is "--- " (for retro-compatibility)
      2. only change xwiki.getSpacePreference() to fallback when the value is "--- ".

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              gdelhumeau Guillaume Delhumeau
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: