Skip to content

Commit

Permalink
don't search dupe urls
Browse files Browse the repository at this point in the history
  • Loading branch information
pushcx committed Jan 16, 2019
1 parent 4841d38 commit d9fc535
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d9fc535

Please sign in to comment.