Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-73354

Some Asset Publisher email variables do not match their described behaviors

    Details

      Description

      When you enable subscriptions to Asset Publisher, you can configure the the email template that is sent out to subscribers. The issue is that some of the variables don't seem to match their help text.

      Here is the Definition of Terms as found underneath the Body
      [$ASSET_ENTRIES$]
      The list of assets
      [$COMPANY_ID$]
      The company ID associated with the assets
      [$COMPANY_MX$]
      The company MX associated with the assets
      [$COMPANY_NAME$]
      The company name associated with the assets
      [$FROM_ADDRESS$]
      address@field.com
      [$FROM_NAME$]
      Name field
      [$PORTAL_URL$]
      localhost
      [$PORTLET_NAME$]
      Asset Publisher
      [$PORTLET_TITLE$]
      Test Assets
      [$SITE_NAME$]
      The site name associated with the assets
      [$TO_ADDRESS$]
      The address of the email recipient
      [$TO_NAME$]
      The name of the email recipient

      Steps to Reproduce
      1. Setup outgoing emails in Liferay. Go to Control Panel -> Server Administration -> Mail.
      Setup an outgoing SMTP server. I used my personal Gmail account.
      2. Change your Liferay user's email address to a real email address. I used my Liferay email address.
      3. Go to any page and add an Asset Publisher portlet.
      4. Configure the AP portlet. Three dots -> Configure -> Subscriptions. Enable Email Subscriptions.
      You don't necessarily need to edit the email template, but I did so to make certain variables easier to see. You can see for my configs. I used

      Dear [$TO_NAME$],
      
      This is an autogenerated email for the [$PORTLET_NAME$] portlet.
      
      The following asset entries have been added to [$PORTLET_TITLE$]: [$ASSET_ENTRIES$].
      
      Sincerely,
      [$FROM_NAME$]
      [$FROM_ADDRESS$]
      
      [$TO_ADDRESS$]
      
      [$TO_NAME$]
      
      [$PORTLET_NAME$]
      
      [$PORTLET_TITLE$]
      
      [$ASSET_ENTRIES$]
      

      5. Save all configurations and exit back to the page.
      6. Subscribe to the AP portlet
      7. Click on the + button and add any type of content via the AP.
      8. Wait 24 hours for the Asset check to trigger. Just kidding! Run this Groovy script so it triggers the check at will:

      import com.liferay.registry.RegistryUtil
      
      def registry = RegistryUtil.getRegistry()
      def assetPublisherUtil = registry.getService("com.liferay.asset.publisher.web.util.AssetPublisherUtil")
      def checkEntriesMethod = assetPublisherUtil.getClass().getMethod("checkAssetEntries")
      
      try {
      checkEntriesMethod.invoke(assetPublisherUtil)
      }
      catch (Exception e) {
      e.printStackTrace(out)
      }
      

      Here is the groovy script to test in master:

      import com.liferay.registry.RegistryUtil
      
      def registry = RegistryUtil.getRegistry()
      def assetEntriesCheckerUtil = registry.getService("com.liferay.asset.publisher.web.internal.messaging.AssetEntriesCheckerUtil")
      def checkEntriesMethod = assetEntriesCheckerUtil.getClass().getMethod("checkAssetEntries")
      
      try {
      checkEntriesMethod.invoke(assetEntriesCheckerUtil)
      }
      catch (Exception e) {
      e.printStackTrace(out)
      }
      

      You'll get an email like this:

      From: Name field <redacted@gmail.com>
      Date: Thu, Jun 22, 2017 at 11:17 AM
      Subject: New Asset Entries Added to Test Assets
      To: "address@field.com" <address@field.com>

      Dear address@field.com,

      This is an autogenerated email for the Asset Publisher portlet.

      The following asset entries have been added to Test Assets: mail test 4, sample.pdf.

      Sincerely,
      Name field
      address@field.com

      address@field.com

      address@field.com

      Asset Publisher

      Test Assets

      mail test 4, sample.pdf

      Result:
      So far I've found these to be incorrect:
      1. [$TO_NAME$] returns the same value as [$FROM_ADDRESS$], and seems to be incorrect based on the description.
      2. [$FROM_ADDRESS$] and [$TO_ADDRESS$] also appear to be the same. In my test, the real FROM_ADDRESS was the email I set in my Server Administration -> Mail.
      3. The TO_ADDRESS was also the same as FROM_ADDRESS, though it still was correctly sent to my user's email address.

      Testing
      Reproduced in 70x-20170618
      Reproduced in master - 5104a3fc06a6f4acc934488a9c8f139b89ea24b9

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 1 week, 2 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP26
                  7.0.X EE
                  7.0.4 CE GA5
                  7.1.0 M1
                  Master