mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 21:34:52 +08:00
FIX: Add strip_secure_urls method to GroupSmtpMailer
* this mailer needs some more cleanup and specs; this commit just adds the missing method so the mailer does not error completely in secure media environments
This commit is contained in:
@ -86,6 +86,19 @@ class GroupSmtpMailer < ActionMailer::Base
|
|||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def strip_secure_urls(raw)
|
||||||
|
urls = Set.new
|
||||||
|
raw.scan(URI.regexp(%w{http https})) { urls << $& }
|
||||||
|
|
||||||
|
urls.each do |url|
|
||||||
|
if (url.start_with?(Discourse.store.s3_upload_host) && FileHelper.is_supported_media?(url))
|
||||||
|
raw = raw.sub(url, "<p class='secure-media-notice'>#{I18n.t("emails.secure_media_placeholder")}</p>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
raw
|
||||||
|
end
|
||||||
|
|
||||||
def html_override(post, context_posts: nil)
|
def html_override(post, context_posts: nil)
|
||||||
UserNotificationRenderer.render(
|
UserNotificationRenderer.render(
|
||||||
template: 'email/notification',
|
template: 'email/notification',
|
||||||
|
Reference in New Issue
Block a user