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 the preview formatting when a variable appears in a link url #344

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

smcmurtry
Copy link
Contributor

@smcmurtry smcmurtry commented Dec 31, 2024

Summary | Résumé

This PR:

  • adds a bunch of tests to check that, when a variable is in a link url, the html we get back is well formatted
  • adds a 2nd regex pattern to match variables inside the url portion of a markdown link
  • adds a regex replace to remove the double brackets from these variables, if no values are passed in and we are just previewing the html. This prevents the html from becoming incorrect after the markdown is converted to html

Related Issues | Cartes liées

Test instructions | Instructions pour tester la modification

  • open up notification-admin locally
  • modify line 52 in pyproject.toml to read:
notifications-utils = { git = "https://github.com/cds-snc/notifier-utils.git", branch = "fix/variable-in-link-bug"}
  • rebuild your admin container and run the app
  • create a template with a variable in a url link like this: [link with variable and query param](((url_var))/en-US/search?q=asdf)
  • Verify that the template preview looks good
  • send the template to yourself and verify the link works correctly in the email (you can set url_var = https://developer.mozilla.org for the example above).

Release Instructions | Instructions pour le déploiement

None.

Reviewer checklist | Liste de vérification du réviseur

  • This PR does not break existing functionality.
  • This PR does not violate GCNotify's privacy policies.
  • This PR does not raise new security concerns. Refer to our GC Notify Risk Register document on our Google drive.
  • This PR does not significantly alter performance.
  • Additional required documentation resulting of these changes is covered (such as the README, setup instructions, a related ADR or the technical documentation).

⚠ If boxes cannot be checked off before merging the PR, they should be moved to the "Release Instructions" section with appropriate steps required to verify before release. For example, changes to celery code may require tests on staging to verify that performance has not been affected.

notifications_utils/field.py Fixed Show fixed Hide fixed
notifications_utils/field.py Fixed Show fixed Hide fixed
tests/test_template.py Fixed Show resolved Hide resolved
@smcmurtry smcmurtry marked this pull request as ready for review January 3, 2025 17:21
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.

1 participant