From 26747540d24eda785ed78f237def8a8d95f52eb0 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Wed, 10 Jan 2024 11:52:57 -0500 Subject: [PATCH] FIX: Chat summary email link in subfolder setups (#25188) This regressed in 2791e75072329fdbf9ebd6849cea3c63664b123c. That commit fixed subfolder URLs in general, but the `full_url` was adding the subfolder prefix a second time, thus breaking this URL in emails. --- plugins/chat/app/models/chat/message.rb | 2 +- plugins/chat/spec/mailers/user_notifications_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/chat/app/models/chat/message.rb b/plugins/chat/app/models/chat/message.rb index a374fa59c72..5fa0eaa987e 100644 --- a/plugins/chat/app/models/chat/message.rb +++ b/plugins/chat/app/models/chat/message.rb @@ -236,7 +236,7 @@ module Chat end def full_url - "#{Discourse.base_url}#{url}" + "#{Discourse.base_url_no_prefix}#{url}" end def url diff --git a/plugins/chat/spec/mailers/user_notifications_spec.rb b/plugins/chat/spec/mailers/user_notifications_spec.rb index 183e1618f00..80e2f914d9e 100644 --- a/plugins/chat/spec/mailers/user_notifications_spec.rb +++ b/plugins/chat/spec/mailers/user_notifications_spec.rb @@ -637,6 +637,17 @@ describe UserNotifications do expect(user_avatar.attribute("alt").value).to eq(sender.username) end + context "with subfolder" do + before { set_subfolder "/community" } + + it "includes correct view summary link in template" do + email = described_class.chat_summary(user, {}) + expect(email.html_part.body.to_s).to include( + "