Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect URLs for edited emails #7671

Merged
merged 3 commits into from
Aug 22, 2024
Merged

Fix incorrect URLs for edited emails #7671

merged 3 commits into from
Aug 22, 2024

Conversation

donnapep
Copy link
Collaborator

@donnapep donnapep commented Aug 22, 2024

Resolves #7621.

Proposed Changes

Strips out the URL protocol if necessary when replacing URL placeholders in the email content (e.g. href="http://[completed:url]" or href="https://[completed:url]"). The placeholder value already contains the protocol and it was being duplicated, resulting in the issue.

Note:

  • I haven't included any test coverage in order to ship this change quickly in today's release.
  • The proper solution would be to not prepend the protocol on save, but that solution is more involved so I opted for a faster one.

Testing Instructions

  1. Open the Student Course Completed email.
  2. Select the View Results button and click the pencil icon to edit it. The URL should be [completed:url].
  3. Click Open in a new tab.
  4. Save the change and the email.
  5. Edit the button again and see that the URL is now http://[completed:url]. (This PR does not address this issue.)
  6. As a student, complete a course.
  7. Click the View Results button and ensure the link is correct.
  8. Click Recreate Emails in Sensei > Tools.
  9. Double check that the URL for the button has been reset to [completed:url]. Don't make any changes or save the email.
  10. As a student, complete a course.
  11. Click the View Results button and ensure the link is correct.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@donnapep donnapep added this to the 4.24.3 milestone Aug 22, 2024
@donnapep donnapep changed the title Fix incorrect URL for CTA for edited emails Fix incorrect URLs for edited emails Aug 22, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

@donnapep donnapep requested a review from a team August 22, 2024 12:17
Copy link
Contributor

@Imran92 Imran92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely as expected! Thanks for fixing this!

@donnapep donnapep merged commit 397e099 into trunk Aug 22, 2024
24 checks passed
@donnapep donnapep deleted the fix/email-url-issue branch August 22, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in Hardcoded [Completed URL]
2 participants