Adobe-Consulting-Services / acs-aem-commons

http://adobe-consulting-services.github.io/acs-aem-commons/
Apache License 2.0
453 stars 600 forks source link

System Notification Breaks Experience Fragment based Target Activities #3362

Closed ulhep closed 4 months ago

ulhep commented 4 months ago

Required Information

Expected Behavior

System Notifications should display to Content Authors.

Actual Behavior

The notifications display just fine. However, when you export or update an Experience Fragment to Target, System Notification code is adding document.write() to the HTML. This BREAKS Adobe Target Activities using those XFs and causes widespread pandemonium across an organization.

Steps to Reproduce

Using above versions of AEM and ACS Commons, create and enable a System Notification. Then, export / update an XF to Target and observe the HTML.

Links

On click of "Export to Target" or "Update to Target", to start with, it initiates a following request:

https://author.uat.apps.xxxx.com/content/experience-fragments/www-xxxx-touch/nl/sandbox/jan/banner/master.html?wcmmode=disabled

The HTML markup received as response contains following system notification code:

And. this causes the issue while using the exported exp fragments in the Adobe Target editor

ulhep commented 4 months ago

To fix the issue, we can add following change in SystemNotificationsImpl.java

protected boolean accepts(final ServletRequest servletRequest,
                            final ServletResponse servletResponse) {

       . . . 
       . . .

        // Do not apply when exporting Target Offers
            if (StringUtils.contains(slingRequest.getQueryString(), "wcmmode=disabled")) {
                return false;
            }
        . . .
        return true;
    }
ulhep commented 4 months ago

Raised a pull request: https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/3363

ulhep commented 4 months ago

@davidjgonzalez When will we create a new release? Currently, acs-aem-commons-6.6.0 is the latest created on 15th April 2024

davidjgonzalez commented 4 months ago

Fixed in 6.6.2 which is now released