Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-97796

Variables in user macro are not resolved

XMLWordPrintable

      Problem

      Inserting a User Macro with variables in a Confluence page results in the variables to be displayed as is without substituting their computed values.

      Environment

      Confluence v9.0.x

      Steps to Reproduce

      1. Login as admin
      2. Define a new User Macro with the following template code:
        ## @noparams
        #set($userDetailsManager = $containerContext.getComponent('userDetailsManager'))
        
        #set( $user = $action.remoteUser)
        <h1>
        Hello $req.userPrincipal.name</h1>
        <br />
        Hello $action.remoteUser.name
        <br />
        Hello $user.name
        
        <pre>
        $action.authenticatedUser.name
        $action.authenticatedUser.fullName
        $action.authenticatedUser.key
        $action.dateFormatter.formatGivenString("yyyy-MM-dd", $content.getCreationDate())
        
        </pre>
        
      3. Set Macro Body Processing to Rendered
      4. Create a new page and add the macro created above.
      5. Save the page

      Expected Results

      Variables in the macro are resolved and the page shows/renders variable values.

      Actual Results

      Macro displays literal variable names instead of resolved / rendered values.
      Factoring in the following system property does not help

      -Dmacro.required.velocity.context.keys=comma,seperated,key,values
      

      Workaround

      Currently there is no known workaround for this behavior.

              854eef6f5746 Kusal Kithul-Godage
              5c3a8aca27ce Mohit Sharma
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: