Fix all the trailing whitespace

This commit is contained in:
Jakub Arnold
2013-02-07 16:45:24 +01:00
parent 1839614bcc
commit 61654ab8f0
230 changed files with 1165 additions and 1165 deletions

View File

@@ -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?