-
Notifications
You must be signed in to change notification settings - Fork 1
fix(ZMSKVR-352): tighten mail template formatting #3003
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
878be65
fix(ZMSKVR-352): tighten mail template formatting
ThomasAFink 8e24340
Merge branch 'next' into feature-zmskvr-352-email-formatting
ThomasAFink 7850149
Merge branch 'next' into feature-zmskvr-352-email-formatting
ThomasAFink d8d3a72
Merge branch 'next' into feature-zmskvr-352-email-formatting
ThomasAFink 7d39693
Merge branch 'next' into feature-zmskvr-352-email-formatting
ThomasAFink ccb6369
fix(ZMSKVR-352): also convert ASCII --- separators in mail templates
ThomasAFink 724d129
Merge branch 'next' into feature-zmskvr-352-email-formatting
ThomasAFink f272258
Merge branch 'next' into feature-zmskvr-352-email-formatting
ThomasAFink 4daa2b0
fix(ZMSKVR-352): restore double Geviertstrich with two breaks
ThomasAFink af45a16
Merge branch 'next' into feature-zmskvr-352-email-formatting
ThomasAFink d3041dc
fix(ZMSKVR-352): convert remaining mail separators and drop unused cu…
ThomasAFink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
zmsbackend/migrations/91785035201-format-mail-templates-spacing-and-dashes.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| START TRANSACTION; | ||
|
|
||
| -- ZMSKVR-352: Formatierung der Standard-E-Mail-Templates | ||
| -- | ||
| -- - Leistungen (Service-Links) nicht mehr bold | ||
| -- - Trennstriche einheitlich als einzelner Geviertstrich (—) | ||
| -- Live-Templates nutzen je nach Umgebung —— (doppelter Geviertstrich) | ||
| -- ODER --- (drei ASCII-Bindestriche); beides wird hier abgedeckt. | ||
| -- - Abstände um Trennstriche / unter "Termin aktivieren" reduzieren | ||
| -- | ||
| -- REGEXP_REPLACE, damit Einrückung, CRLF/LF und optionale Leerzeilen | ||
| -- die Ersetzung nicht verhindern (das war der Fehlschlag auf zms-dev). | ||
| -- Idempotent: bereits umgestellte Templates bleiben unverändert. | ||
| -- | ||
| -- Betrifft mail_confirmation, mail_preconfirmed und mail_reminder | ||
| -- (global + customized). Lange Alt-Trenner (----------------------) | ||
| -- bleiben unangetastet. | ||
|
|
||
| -- 1) Leistungen: <strong> um Service-Links entfernen (beliebige href) | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| '<strong>[[:space:]]*<a href="([^"]+)">[[:space:]]*(\\{\\{ requestGroup\\[''request''\\]\\.name \\}\\})[[:space:]]*</a>[[:space:]]*</strong>', | ||
| '<a href="\\1">\\2 </a>' | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` REGEXP '<strong>[[:space:]]*<a href="[^"]+">[[:space:]]*\\{\\{ requestGroup\\[''request''\\]\\.name'; | ||
|
|
||
| -- 2) Trennlinie aus genau drei ASCII-Bindestrichen → Geviertstrich | ||
| -- (nur ganze Zeile, nicht Teil von ----------------------) | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '([[:blank:]]*)---([[:blank:]]*)', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ), | ||
| CONCAT('\\1', '\\2', '—', '\\3', '\\4') | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` REGEXP CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '[[:blank:]]*---[[:blank:]]*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ); | ||
|
|
||
| -- 3) Trennlinie aus doppeltem Geviertstrich → einzelner Geviertstrich | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '([[:blank:]]*)——([[:blank:]]*)', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ), | ||
| CONCAT('\\1', '\\2', '—', '\\3', '\\4') | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` LIKE '%——%'; | ||
|
|
||
| -- 4) <br><br> / extra Leerzeilen um den Geviertstrich → je ein <br> | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '<br[[:space:]]*/?>', | ||
| '([[:space:]]*<br[[:space:]]*/?>)?', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '([[:blank:]]*)—([[:blank:]]*)', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '([[:blank:]]*)<br[[:space:]]*/?>', | ||
| '([[:space:]]*<br[[:space:]]*/?>)?' | ||
| ), | ||
| CONCAT('<br>', CHAR(13), CHAR(10), '\\3—\\4', CHAR(13), CHAR(10), '\\6<br>') | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` LIKE '%—%' | ||
| AND ( | ||
| `value` LIKE '%<br><br>%—%' | ||
| OR `value` LIKE '%—%<br><br>%' | ||
| OR `value` LIKE '%<br /><br />%—%' | ||
| ); | ||
|
|
||
| -- 5) Abstand unter "Termin aktivieren" reduzieren | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| 'Termin aktivieren</a></strong>[[:space:]]*<br[[:space:]]*/?>([[:space:]]*<br[[:space:]]*/?>)?', | ||
| CONCAT('Termin aktivieren</a></strong>', CHAR(13), CHAR(10), '<br>') | ||
| ) | ||
| WHERE `name` = 'mail_preconfirmed.twig' | ||
| AND `value` LIKE '%Termin aktivieren%</strong>%<br%'; | ||
|
|
||
| -- 6) Catch-all: verbleibender doppelter Geviertstrich (nicht zeilenweise) | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REPLACE(`value`, '——', '—') | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` LIKE '%——%'; | ||
|
|
||
| COMMIT; | ||
111 changes: 111 additions & 0 deletions
111
zmsbackend/migrations/91785035202-format-mail-templates-ascii-hyphen-separators.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| START TRANSACTION; | ||
|
|
||
| -- ZMSKVR-352 follow-up: zms-dev (and any env that already applied | ||
| -- 91785035201) still showed ASCII-hyphen separators (---) and the old | ||
| -- <br><br> spacing. The first migration only matched double em-dashes (——). | ||
| -- | ||
| -- Same transforms as the updated 91785035201; idempotent so later | ||
| -- environments that run both files are unchanged the second time. | ||
|
|
||
| -- 1) Leistungen: <strong> um Service-Links entfernen (beliebige href) | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| '<strong>[[:space:]]*<a href="([^"]+)">[[:space:]]*(\\{\\{ requestGroup\\[''request''\\]\\.name \\}\\})[[:space:]]*</a>[[:space:]]*</strong>', | ||
| '<a href="\\1">\\2 </a>' | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` REGEXP '<strong>[[:space:]]*<a href="[^"]+">[[:space:]]*\\{\\{ requestGroup\\[''request''\\]\\.name'; | ||
|
|
||
| -- 2) Trennlinie aus genau drei ASCII-Bindestrichen → Geviertstrich | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '([[:blank:]]*)---([[:blank:]]*)', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ), | ||
| CONCAT('\\1', '\\2', '—', '\\3', '\\4') | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` REGEXP CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '[[:blank:]]*---[[:blank:]]*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ); | ||
|
|
||
| -- 3) Trennlinie aus doppeltem Geviertstrich → einzelner Geviertstrich | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '([[:blank:]]*)——([[:blank:]]*)', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ), | ||
| CONCAT('\\1', '\\2', '—', '\\3', '\\4') | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` LIKE '%——%'; | ||
|
|
||
| -- 4) <br><br> / extra Leerzeilen um den Geviertstrich → je ein <br> | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '<br[[:space:]]*/?>', | ||
| '([[:space:]]*<br[[:space:]]*/?>)?', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '([[:blank:]]*)—([[:blank:]]*)', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '([[:blank:]]*)<br[[:space:]]*/?>', | ||
| '([[:space:]]*<br[[:space:]]*/?>)?' | ||
| ), | ||
| CONCAT('<br>', CHAR(13), CHAR(10), '\\3—\\4', CHAR(13), CHAR(10), '\\6<br>') | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` LIKE '%—%' | ||
| AND ( | ||
| `value` LIKE '%<br><br>%—%' | ||
| OR `value` LIKE '%—%<br><br>%' | ||
| OR `value` LIKE '%<br /><br />%—%' | ||
| ); | ||
|
|
||
| -- 5) Abstand unter "Termin aktivieren" reduzieren | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| 'Termin aktivieren</a></strong>[[:space:]]*<br[[:space:]]*/?>([[:space:]]*<br[[:space:]]*/?>)?', | ||
| CONCAT('Termin aktivieren</a></strong>', CHAR(13), CHAR(10), '<br>') | ||
| ) | ||
| WHERE `name` = 'mail_preconfirmed.twig' | ||
| AND `value` LIKE '%Termin aktivieren%</strong>%<br%'; | ||
|
|
||
| -- 6) Catch-all: verbleibender doppelter Geviertstrich | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REPLACE(`value`, '——', '—') | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` LIKE '%——%'; | ||
|
|
||
| COMMIT; |
47 changes: 47 additions & 0 deletions
47
zmsbackend/migrations/91785035203-format-mail-templates-double-emdash-separator.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| START TRANSACTION; | ||
|
|
||
| -- ZMSKVR-352 follow-up: use a double Geviertstrich with two <br> on each side: | ||
| -- a double Geviertstrich with two <br> on each side: | ||
| -- | ||
| -- <br><br> | ||
| -- —— | ||
| -- <br><br> | ||
| -- | ||
| -- 91785035201/35202 already ran on some envs and left a single — with one | ||
| -- <br>. A lone —— can also wrap onto two lines in some clients, so wrap it | ||
| -- in nowrap. Idempotent: the canonical block matches itself. | ||
| -- | ||
| -- Does not touch long ASCII rules (----------------------). | ||
|
|
||
| -- Standalone separator line (—, ——, ---, optional nowrap span) plus any | ||
| -- surrounding <br> tags → canonical two-break nowrap double Geviertstrich. | ||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '(<br[[:space:]]*/?>[[:space:]]*)*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '[[:blank:]]*(<span style="white-space:nowrap">)?(——|—|---)(</span>)?[[:blank:]]*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '([[:blank:]]*<br[[:space:]]*/?>[[:space:]]*)*' | ||
| ), | ||
| CONCAT( | ||
| '<br><br>', | ||
| CHAR(13), CHAR(10), | ||
| '<span style="white-space:nowrap">——</span>', | ||
|
ThomasAFink marked this conversation as resolved.
|
||
| CHAR(13), CHAR(10), | ||
| '<br><br>' | ||
| ) | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig' | ||
| ) | ||
| AND `value` REGEXP CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '[[:blank:]]*(<span style="white-space:nowrap">)?(——|—|---)(</span>)?[[:blank:]]*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ); | ||
|
|
||
| COMMIT; | ||
66 changes: 66 additions & 0 deletions
66
zmsbackend/migrations/91785035204-format-mail-templates-remaining-separators.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| START TRANSACTION; | ||
|
|
||
| -- ZMSKVR-352 follow-up: remaining mail templates still use mixed | ||
| -- standalone separator lines that 91785035203 did not cover: | ||
| -- | ||
| -- <br><br> (mail_delete.twig) | ||
| -- — | ||
| -- <br><br> | ||
| -- | ||
| -- <br><br> (mail_delete.twig) | ||
| -- --- | ||
| -- <br><br> | ||
| -- | ||
| -- <br /><br /> (mail_queued.twig and customized | ||
| -- ---------------------- mail_confirmation.twig; indented) | ||
| -- <br /><br /> | ||
| -- | ||
| -- 35203 only matched (——|—|---) on confirmation/preconfirmed/reminder, | ||
| -- so long ASCII rules and delete/queued copies were left behind. | ||
| -- mail_admin_delete.twig is included so customized copies with dashes | ||
| -- are converted too (current dump rows have none). | ||
| -- | ||
| -- Same canonical block as 91785035203. Idempotent: that block matches | ||
| -- itself. Standalone line only (newline-bounded), so hyphens inside | ||
| -- URLs are not touched. | ||
| -- | ||
| -- Dash forms (longer first; no —+ because MariaDB REGEXP is byte-based): | ||
| -- —— double Geviertstrich | ||
| -- — single Geviertstrich | ||
| -- -{3,} ---, ----------------------, and any longer ASCII rule | ||
| -- –– double Halbgeviertstrich | ||
| -- – single Halbgeviertstrich | ||
|
|
||
| UPDATE `mailtemplate` | ||
| SET `value` = REGEXP_REPLACE( | ||
| `value`, | ||
| CONCAT( | ||
| '(<br[[:space:]]*/?>[[:space:]]*)*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '[[:blank:]]*(<span style="white-space:nowrap">)?(——|—|-{3,}|––|–)(</span>)?[[:blank:]]*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')+', | ||
| '([[:blank:]]*<br[[:space:]]*/?>[[:space:]]*)*' | ||
| ), | ||
| CONCAT( | ||
| '<br><br>', | ||
| CHAR(13), CHAR(10), | ||
| '<span style="white-space:nowrap">——</span>', | ||
| CHAR(13), CHAR(10), | ||
| '<br><br>' | ||
| ) | ||
| ) | ||
| WHERE `name` IN ( | ||
| 'mail_confirmation.twig', | ||
| 'mail_preconfirmed.twig', | ||
| 'mail_reminder.twig', | ||
| 'mail_delete.twig', | ||
| 'mail_admin_delete.twig', | ||
| 'mail_queued.twig' | ||
| ) | ||
| AND `value` REGEXP CONCAT( | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')', | ||
| '[[:blank:]]*(<span style="white-space:nowrap">)?(——|—|-{3,}|––|–)(</span>)?[[:blank:]]*', | ||
| '(', CHAR(13), CHAR(10), '|', CHAR(10), ')' | ||
| ); | ||
|
|
||
| COMMIT; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.