Remove duplication in TextWithLinksHelper

We were using `Rinku.auto_link` the same way twice. And it makes sense
that the method `sanitize_and_auto_link` first sanitizes the text and
then calls `auto_link_already_sanitized_text`.
This commit is contained in:
Javi Martín
2019-10-06 04:42:07 +02:00
parent 0b40865e61
commit 2586229e38

View File

@@ -3,7 +3,7 @@ module TextWithLinksHelper
def sanitize_and_auto_link(text) def sanitize_and_auto_link(text)
return unless text return unless text
sanitized = sanitize(text, tags: [], attributes: []) sanitized = sanitize(text, tags: [], attributes: [])
Rinku.auto_link(sanitized, :all, 'target="_blank" rel="nofollow"').html_safe auto_link_already_sanitized_html(sanitized)
end end
def auto_link_already_sanitized_html(html) def auto_link_already_sanitized_html(html)