Uploaded image for project: 'Release Notes Application'
  1. Release Notes Application
  2. RN-79

The release note template page displays raw Velocity code as its title

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.4.1
    • 2.0
    • Application
    • None
    • Integration
    • Unknown
    • N/A

    Description

      Problem

      ReleaseNotes.Code.ReleaseNoteTemplate carries a dynamic title, Release Notes for $doc.getValue('product') $doc.getValue('version'), which HomeReleaseNotes copies to every release note created from the application home page. On a created release note that title resolves, because the page holds a ReleaseNoteClass xobject with a product and a version. That design is sound and is kept.

      The template page itself holds no such xobject, so on that page neither reference resolves and Velocity leaves them as literal text. Wherever the template page is displayed by its title, the user is shown the raw script instead of a name:

      • in the "Template Reference" page picker of the wiki administration (Administration > Other > Release Notes), which is exactly where an administrator is asked to pick that page
      • on the template page itself, in its breadcrumb, in search results and in the document index

      Proposal

      Give the title a fallback for the case where the page has no release note xobject, the same idiom ReleaseNotes.Code.Change.ChangeSheet already uses:

      #if ("$!doc.getValue('product')" != '')Release Notes for $doc.getValue('product') $doc.getValue('version')#{else}Release Note Template#end
      

      The template page then reads "Release Note Template", while release notes created from it keep their dynamic title unchanged.

      Note for whoever tests this

      ReleaseNotesIT#createReleaseNoteFromTemplate used to flatten the template title before creating the release note, which makes the fix above look broken (every created release note comes out titled "Release Note Template").

      The cause is in the test helper, not in the application: the REST API fills Page#title with the rendered title (ModelFactory does pageSummary.setTitle(doc.getDisplayTitle())) and, on save, stores whatever it is given as the page's raw title (doc.setTitle(restPage.getTitle())). So a plain REST get/save round-trip on a page whose title holds Velocity silently replaces that title with its rendered form. The helper that turns required rights on for the template did exactly that. It now clears the title before saving, so that the stored one is left alone.

      This is worth keeping in mind for any other code doing a REST round-trip on a page with a scripted title.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: