mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:13:39 +08:00
FIX: elided content in email should always have an href
Not 100% sure why the changes in `PrettyText.format_for_email` raised this issue, but we were missing adding a link to the Discourse instance whenever we are replacing the elided part of a post with a link to either the post or the Discourse instance in the email. Also reformated the specs using better variable names (sometimes a variable named `md` would contain some html) and used the `match_html` helper for all the tests.
This commit is contained in:
@ -37,7 +37,7 @@ after_initialize do
|
||||
.each do |el|
|
||||
text = el.css("summary").text
|
||||
link = fragment.document.create_element("a")
|
||||
link["href"] = post.url if post
|
||||
link["href"] = post&.url.presence || Discourse.base_url
|
||||
link.content = I18n.t("details.excerpt_details")
|
||||
el.replace CGI.escapeHTML(text) + " " + link.to_html
|
||||
end
|
||||
|
Reference in New Issue
Block a user