FIX: subfolder digest emails have incorrect URLs

This commit is contained in:
Neil Lalonde
2018-08-07 16:38:17 -04:00
parent 17d8fea796
commit 4e6e4a83df
4 changed files with 23 additions and 9 deletions
+17 -3
View File
@@ -127,9 +127,7 @@ describe UserNotifications do
context "with new topics" do
before do
Fabricate(:topic, user: Fabricate(:coding_horror), created_at: 1.hour.ago)
end
let!(:popular_topic) { Fabricate(:topic, user: Fabricate(:coding_horror), created_at: 1.hour.ago) }
it "works" do
expect(subject.to).to eq([user.email])
@@ -206,6 +204,22 @@ describe UserNotifications do
expect(html).to include '1E1E1E'
expect(html).to include '858585'
end
it "supports subfolder" do
GlobalSetting.stubs(:relative_url_root).returns('/forum')
Discourse.stubs(:base_uri).returns("/forum")
html = subject.html_part.body.to_s
text = subject.text_part.body.to_s
expect(html).to be_present
expect(text).to be_present
expect(html).to_not include("/forum/forum")
expect(text).to_not include("/forum/forum")
expect(subject.header["List-Unsubscribe"].to_s).to match(/http:\/\/test.localhost\/forum\/email\/unsubscribe\/\h{64}/)
topic_url = "http://test.localhost/forum/t/#{popular_topic.slug}/#{popular_topic.id}"
expect(html).to include(topic_url)
expect(text).to include(topic_url)
end
end
end