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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.2-milestone-2
    • Fix Version/s: 10.8.1, 10.9
    • Component/s: Old Core
    • Labels:
      None
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: