Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-6707

Incorrect resources are loaded based on condition in Customer Portal

    XMLWordPrintable

Details

    Description

      Issue Summary

      Atlassian plugin vendor are extending SimpleUrlReadingCondition according to https://bitbucket.org/atlassian_tutorial/tutorial-licensed-conditions/src/master/src/main/java/com/example/plugins/conditions/IsPluginLicensedCondition.java. When using this condition to load a web-resource in the customerportal context, the wrong resource is loaded.

      As a consequence:

      • a lot of Service Desk portal URLs are corrupted since the string "customer/portal/undefined/servicedesk" is being mistakenly added to it, and accessing such URL returns a 404 error with the message "Oops, you've found a dead link".
      • some functionalities from the customer portal will fail to work: for example, icon/avatar images might not be loaded on the customer, workflow transitions might fail on the customer portal, etc...

      For example:

      • Customer Portal Icons (Avatar):
        • A normal icon URL should be like this:
          <JIRA_BASE_URL>/servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10610
          
        • However, when the bug occurs, the URL is modified to the following invalid URL:
          <JIRA_BASE_URL>/servicedesk/customer/undefined/servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10610
          
      • Customer Portal Transition
        • A normal transition URL should be like this:
          <JIRA_BASE_URL>/rest/servicedesk/1/customer/requests/transition
          
        • However, when the bug occurs, the URL is modified to the following invalid URL:
          <JIRA_BASE_URL>/servicedesk/customer/portal/37/undefined/rest/servicedesk/1/customer/requests/transition
          

      Steps to Reproduce

      1. Create a test plugin that uses a condition to load resources on the customer portal (see screenshots/attachments)

      atlassian-plugin.xml snippet

          <web-resource key="test-true" name="test-true">
              <resource type="download" name="condition-true.js" location="/js/condition-true.js"/>
              <context>customerportal</context>
              <condition class="com.atlassian.test.impl.TestCondition"/>
          </web-resource>
      
          <web-resource key="test-false" name="test-false">
              <resource type="download" name="condition-false.js" location="/js/condition-false.js"/>
              <context>customerportal</context>
              <condition class="com.atlassian.test.impl.TestCondition" invert="true"/>
          </web-resource>
      

      Expected Results

      The resource associated with the TestCondition being true is loaded

      Actual Results

      The resource associated with the TestCondition being false is loaded

      Workaround

      Enable the feature flag sd.frontend.legacy.webresource.loading.customerportal.enabled:

      1. Go to Dark feature page (<baseURL>/secure/admin/SiteDarkFeatures!default.jspa)
      2. Add the following dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              c7dfe7a6b4d2 Heiko Gerlach
              Votes:
              17 Vote for this issue
              Watchers:
              61 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Backbone Issue Sync