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

'labelsString' param doesn't works on 'createblogpost.action'

    XMLWordPrintable

Details

    Description

      Summary

      The following URI used to work to create a blog post with specified label name does not work anymore in newest Confluence version (5.8.x)

      /pages/createblogpost.action?spaceKey=<SpaceName>&labelsString=<LabelName>

      Steps to Reproduce

      1. Create a blog post by pasting the following URI:
        /pages/createblogpost.action?spaceKey=TEST&labelsString=test1,test2
        
        • The above URI should create a new blog post in a space with the space key TEST with the following labels : (test1,test2)

      Expected Results

      the blog post page is created with the correct labels (test1,test2) saved

      Actual Results

      Blog is created, and the label count is correctly specified. However, the labels are not saved.

      Workaround 1

      Note: this workaround only works when Collaborative Editing is disabled.

      1. Click cog icon > General Configuration > Custom HTML
      2. Click the Edit button
      3. Paste the following into the At end of the Body field:
        <script type="text/javascript">
          
        AJS.toInit(function ($) {
          
             //is it a create page action which is called??
            if( window.location.href.indexOf("createpage.action") > -1 || window.location.href.indexOf("createblogpost.action")) {
                  
                //if yes is there a label given as request parameter???
                var label = getUrlVars()["labels-string"];
                if(label) {
                      
                    //simply click the labeleditbutton
                    jQuery("#rte-button-labels").trigger("click");
                    //insert the label parameter value
                    jQuery("#labels-string").val(label);
                    //and close the label editor
                    jQuery("#add-labels-editor-button").trigger("click");
         
                    jQuery(".dialog-button-panel a.button-panel-cancel-link").trigger("click");
         
                }
            }
        });
          
        //this function is needed to get the parameters from the url
        function getUrlVars()
        {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for(var i = 0; i < hashes.length; i++)
            {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
          
        </script><br><br>
      4. Click Save
      5. Clear your browser cache

      You should now be able to create a new blog post and add labels using the following:

      pages/createblogpost.action?spaceKey=<spaceKey>&labels-string=label1,label2

      Note: the parameter is labels-string vs labelsString

      Workaround 2

      If you need a workaround that complies with Collaborative Editing, bitvoodoo did push out a third party fix that is available on the Marketplace: Label Fixer. This allows you to use the normal labelsString parameter to declare the labels in comma separated values.

      WARNING: Per our Support Offerings, HTML customizations are not supported by the Atlassian support team, but we will always do their best to assist. As with all customizations, we strongly recommended testing in a development environment, prior to implementing in production. Any customizations may need to be reapplied after upgrading.

      Notes

      1. Some customers use this parameter in order to avoid selecting different label name mistakenly.
      2. This method was available previously in 5.0.3
      3. Stopped working in the latest version, 5.8.x and 5.9.1

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mnakagawa Mai Nakagawa (Inactive)
              Votes:
              79 Vote for this issue
              Watchers:
              70 Start watching this issue

              Dates

                Created:
                Updated: