From 98e1b759e5e54a896cc3ef26fd44e2e40a7e4705 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sun, 13 Sep 2026 16:19:21 +0900 Subject: [PATCH] Apply "user-current" and "user-mentionable" styles to user mentions in email notifications --- app/views/layouts/mailer.html.erb | 10 ++++++++++ test/unit/mailer_test.rb | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 249e29af8..e5f783d8f 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -13,6 +13,16 @@ h2, h3 { font-size: 1.1em; } a, a:link, a:visited { color: #1864ab; /* oc-blue-9 */ } a:hover, a:active { color: #c92a2a; /* oc-red-9 */ } a.wiki-anchor { display: none; } +a.user.user-mention { + padding: 0.1em; + border-radius: 0.1em; +} +a.user.user-mention.user-mentionable { + background-color: #e7f5ff; /* oc-blue-0 */ +} +a.user.user-mention.user-current { + background-color: #ffe8cc; /* oc-orange-1 */ +} fieldset.attachments { border-width: 1px 0 0 0; border-style: solid; diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index ab880ef45..eb506c393 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -513,6 +513,13 @@ class MailerTest < ActiveSupport::TestCase # @dlopper won't receive duplicated notifications assert_equal 3, ActionMailer::Base.deliveries.size assert_include User.find(1).mail, recipients + + # In the email sent to admin, the mention of admin is marked as the + # current user and both mentioned users are marked as mentionable + mail = ActionMailer::Base.deliveries.find {|m| m.to.include?(User.find(1).mail)} + html = mail.parts.detect {|part| part.content_type.include?('text/html')}.body.encoded + assert_select_in html, 'a.user-mention.user-current.user-mentionable[href$=?]', '/users/1', 1 + assert_select_in html, 'a.user-mention.user-mentionable:not(.user-current)[href$=?]', '/users/3', 1 end def test_issue_add_should_include_enabled_fields -- 2.55.0