mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Fix all the trailing whitespace
This commit is contained in:
@@ -2,7 +2,7 @@ require 'uri'
|
||||
require_dependency 'slug'
|
||||
|
||||
class TopicLink < ActiveRecord::Base
|
||||
|
||||
|
||||
belongs_to :topic
|
||||
belongs_to :user
|
||||
belongs_to :post
|
||||
@@ -26,7 +26,7 @@ class TopicLink < ActiveRecord::Base
|
||||
# Extract any urls in body
|
||||
def self.extract_from(post)
|
||||
return unless post.present?
|
||||
|
||||
|
||||
TopicLink.transaction do
|
||||
|
||||
added_urls = []
|
||||
@@ -37,7 +37,7 @@ class TopicLink < ActiveRecord::Base
|
||||
.map{|u| [u, URI.parse(u)] rescue nil}
|
||||
.reject{|u,p| p.nil?}
|
||||
.uniq{|u,p| u}
|
||||
.each do |url, parsed|
|
||||
.each do |url, parsed|
|
||||
begin
|
||||
|
||||
internal = false
|
||||
@@ -45,7 +45,7 @@ class TopicLink < ActiveRecord::Base
|
||||
post_number = nil
|
||||
if parsed.host == Discourse.current_hostname || !parsed.host
|
||||
internal = true
|
||||
|
||||
|
||||
route = Rails.application.routes.recognize_path(parsed.path)
|
||||
topic_id = route[:topic_id]
|
||||
post_number = route[:post_number] || 1
|
||||
@@ -55,8 +55,8 @@ class TopicLink < ActiveRecord::Base
|
||||
next if topic_id == post.topic_id
|
||||
|
||||
added_urls << url
|
||||
TopicLink.create(post_id: post.id,
|
||||
user_id: post.user_id,
|
||||
TopicLink.create(post_id: post.id,
|
||||
user_id: post.user_id,
|
||||
topic_id: post.topic_id,
|
||||
url: url,
|
||||
domain: parsed.host || Discourse.current_hostname,
|
||||
@@ -94,9 +94,9 @@ class TopicLink < ActiveRecord::Base
|
||||
rescue URI::InvalidURIError
|
||||
# if the URI is invalid, don't store it.
|
||||
rescue ActionController::RoutingError
|
||||
# If we can't find the route, no big deal
|
||||
# If we can't find the route, no big deal
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Remove links that aren't there anymore
|
||||
if added_urls.present?
|
||||
|
||||
Reference in New Issue
Block a user