Automattic / newspack-popups

Popup notifications.
GNU General Public License v2.0
70 stars 17 forks source link

fix: disable manual & custom placement prompts when prompts are disabled #1299

Closed dkoo closed 5 months ago

dkoo commented 5 months ago

All Submissions:

Changes proposed in this Pull Request:

When the "Disable prompts on this post or page" setting is turned on for a post or page, the shortcode render method for prompts doesn't pay attention to this filter, which means that any prompts rendered via the shortcode (including Custom Placements and Manual placement prompts) will continue to render. This PR fixes this.

How to test the changes in this Pull Request:

  1. Publish two prompts: one with a custom placement, and the other set to "Manual Only" in the "Everyone" segment.
  2. On a post or page, add a Custom Placement and Single Prompt block, and select the prompts you created in step 1. Enable the "Disable prompts on this post or page" option in the sidebar and publish.
  3. On release, visit the post as a reader and observe that both prompts are rendered despite the option.
  4. Check out this branch and refresh, and confirm that neither prompt is rendered.
  5. Uncheck the "Disable prompts on this post or page" option and save. Refresh the post and confirm that both prompts reappear.

Other information:


matticbot commented 5 months ago

:tada: This PR is included in version 2.31.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: