X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2f9291ba5764fe104264ae7e3b6a361e11212e8b..14936150ac8ab5cb4e8347b772b2c966f2add43f:/lib/rich_text.rb diff --git a/lib/rich_text.rb b/lib/rich_text.rb index 2b3e07d6a..a0c4d9c8d 100644 --- a/lib/rich_text.rb +++ b/lib/rich_text.rb @@ -37,16 +37,16 @@ module RichText link_size += link.content.length end - link_proportion = link_size.to_f / doc.content.length.to_f + link_proportion = link_size.to_f / doc.content.length end spammy_phrases = SPAMMY_PHRASES.count do |phrase| doc.content.include?(phrase) end - [link_proportion - 0.2, 0.0].max * 200 + - link_count * 40 + - spammy_phrases * 40 + ([link_proportion - 0.2, 0.0].max * 200) + + (link_count * 40) + + (spammy_phrases * 40) end protected @@ -61,9 +61,9 @@ module RichText def linkify(text, mode = :urls) if text.html_safe? - Rinku.auto_link(text, mode, tag_builder.tag_options(:rel => "nofollow noopener noreferer")).html_safe + Rinku.auto_link(text, mode, tag_builder.tag_options(:rel => "nofollow noopener noreferrer")).html_safe else - Rinku.auto_link(text, mode, tag_builder.tag_options(:rel => "nofollow noopener noreferer")) + Rinku.auto_link(text, mode, tag_builder.tag_options(:rel => "nofollow noopener noreferrer")) end end end