Skip to content

Commit f12fc75

Browse files
authored
Migrate remaining mailers to format_mail_html / format_mail_text (#23387)
The view-helper migration introduced by the parent PR now covers the remaining mailer surfaces: UserMailer (`message_posted`, `news_added`, `news_comment_added`), ProjectMailer (`project_created`), ProjectArtifactsMailer (`creation_wizard_submitted`), MemberMailer (`added_project`, `updated_project`, `updated_global`), AnnouncementMailer (`announce`), DocumentsMailer (`document_added`), and the shared mailer layout (`localized_emails_header`, `localized_emails_footer`). Sites drop the `static_html: true` / `only_path: false` / `plain_text: true` boilerplate; `render_mode:` pinning lives in the helper. The layout previously called `OpenProject::TextFormatting::Renderer.format_text` directly, bypassing the helper layer. The empty visibility cache (no current_user-scoped preload at layout time) is handled by the existing fallback in `LinkHandlers::WorkPackages#text_only?` — covered by a new sanity spec in `user_mailer_spec.rb` that exercises the header path with a WP reference and asserts plain-text formatted_id rendering. Per-bucket regression coverage added: absolute-URL and formatted_id assertions across both classic and semantic identifier modes, mirroring the WorkPackageMailer spec pattern.
1 parent 998623e commit f12fc75

17 files changed

Lines changed: 231 additions & 14 deletions

app/views/announcement_mailer/announce.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
<% if body_subheader %>
1414
<tr>
1515
<td style="<%= placeholder_text_styles("font-weight": "bold") %>">
16-
<%= format_text body_subheader %>
16+
<%= format_mail_html body_subheader %>
1717
</td>
1818
</tr>
1919
<% end %>
2020
<% if body_header %>
2121
<tr>
2222
<td style="<%= placeholder_text_styles(color: "#333333", "line-height": "36px", "font-size": "18px", "font-weight": "bold") %>">
23-
<%= format_text body_header %>
23+
<%= format_mail_html body_header %>
2424
</td>
2525
</tr>
2626
<% end %>
2727
<tr>
2828
<td style="<%= placeholder_text_styles %>">
29-
<%= format_text body %>
29+
<%= format_mail_html body %>
3030
</td>
3131
</tr>
3232
</table>

app/views/layouts/mailer.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ See COPYRIGHT and LICENSE files for more details.
102102
<table class="header">
103103
<tr>
104104
<td>
105-
<%= OpenProject::TextFormatting::Renderer.format_text(Setting.localized_emails_header) %>
105+
<%= format_mail_html(Setting.localized_emails_header) %>
106106
</td>
107107
</tr>
108108
</table>
@@ -118,7 +118,7 @@ See COPYRIGHT and LICENSE files for more details.
118118
<table class="footer">
119119
<tr>
120120
<td>
121-
<%= OpenProject::TextFormatting::Renderer.format_text(Setting.localized_emails_footer) %>
121+
<%= format_mail_html(Setting.localized_emails_footer) %>
122122
</td>
123123
</tr>
124124
</table>

app/views/member_mailer/added_project.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77
%>
88

9-
<%= format_text(@message) %>
9+
<%= format_mail_html(@message) %>
1010

1111
<%= I18n.t(:"mail_member_added_project.body.roles") %>
1212
<ul>

app/views/member_mailer/updated_global.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
)
66
%>
77

8-
<%= format_text(@message) %>
8+
<%= format_mail_html(@message) %>
99

1010
<%= I18n.t(:"mail_member_updated_global.body.roles") %>
1111
<ul>

app/views/member_mailer/updated_project.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77
%>
88

9-
<%= format_text(@message) %>
9+
<%= format_mail_html(@message) %>
1010

1111
<%= I18n.t(:"mail_member_updated_project.body.roles") %>
1212
<ul>

app/views/project_artifacts_mailer/creation_wizard_submitted.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
2929

3030
<h1><%= link_to @project.name, project_url(@project) %></h1>
3131

32-
<%= format_text(@notification_text, project: @project) %>
32+
<%= format_mail_html(@notification_text, project: @project) %>
3333

3434
<% if @work_package&.visible? %>
3535
<p>

app/views/project_mailer/project_created.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
2929

3030
<h1><%= link_to @project.name, project_url(@project) %></h1>
3131

32-
<%= format_text(@notification_text, project: @project) %>
32+
<%= format_mail_html(@notification_text, project: @project) %>
3333

3434
<% if @project.project_creation_wizard_enabled? %>
3535
<p>

app/views/user_mailer/message_posted.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ See COPYRIGHT and LICENSE files for more details.
3232
</h1>
3333
<em><%= @message.author %></em>
3434

35-
<%= format_text @message.content, object: @message, only_path: false %>
35+
<%= format_mail_html @message.content, object: @message %>

app/views/user_mailer/news_added.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ See COPYRIGHT and LICENSE files for more details.
3030
<h1><%= link_to @news.title, project_news_url(@news.project, @news) %></h1>
3131
<em><%= @news.author&.name %></em>
3232

33-
<%= format_text @news.description, only_path: false %>
33+
<%= format_mail_html @news.description %>

app/views/user_mailer/news_comment_added.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ See COPYRIGHT and LICENSE files for more details.
3131

3232
<p><%= t(:text_user_wrote, value: @comment.author) %></p>
3333

34-
<%= format_text @comment.text, only_path: false %>
34+
<%= format_mail_html @comment.text %>

0 commit comments

Comments
 (0)