From d9fc5356d605ce935703c5e329a64c3ab34c6139 Mon Sep 17 00:00:00 2001 From: Peter Bhat Harkins Date: Mon, 14 Jan 2019 20:51:12 -0600 Subject: [PATCH] don't search dupe urls --- app/models/story.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/story.rb b/app/models/story.rb index b48f2d652..a76d0998e 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -195,21 +195,21 @@ def self.find_similar_by_url(url) urls2.push u.gsub(/^http:\/\//i, "https://") urls2.push u.gsub(/^https:\/\//i, "http://") end - urls = urls2.clone + urls = urls2.uniq # trailing slash urls.each do |u| urls2.push u.gsub(/\/+\z/, "") urls2.push u + "/" end - urls = urls2.clone + urls = urls2.uniq # www prefix urls.each do |u| urls2.push u.gsub(/^(https?:\/\/)www\d*\./i) {|_| $1 } urls2.push u.gsub(/^(https?:\/\/)/i) {|_| "#{$1}www." } end - urls = urls2.clone + urls = urls2.uniq # if a previous submission was moderated, return it to block it from being # submitted again