]> git.openstreetmap.org Git - rails.git/blobdiff - lib/rich_text.rb
Bump osm-community-index from 5.7.0 to 5.7.1
[rails.git] / lib / rich_text.rb
index 2b3e07d6acb72b0221379ea0d0a80c681f383b78..56d358bd8dcb2823afa64a7dcb56e62f5a40d589 100644 (file)
@@ -15,7 +15,7 @@ module RichText
     include ActionView::Helpers::TextHelper
     include ActionView::Helpers::OutputSafetyHelper
 
     include ActionView::Helpers::TextHelper
     include ActionView::Helpers::OutputSafetyHelper
 
-    def sanitize(text)
+    def sanitize(text, _options = {})
       Sanitize.clean(text, Sanitize::Config::OSM).html_safe
     end
   end
       Sanitize.clean(text, Sanitize::Config::OSM).html_safe
     end
   end
@@ -37,16 +37,16 @@ module RichText
           link_size += link.content.length
         end
 
           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
 
       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
     end
 
     protected
@@ -61,9 +61,9 @@ module RichText
 
     def linkify(text, mode = :urls)
       if text.html_safe?
 
     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
       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
       end
     end
   end