store ip address and current user with incoming links

make links long an readable in share dialog
This commit is contained in:
Sam
2013-04-26 16:18:41 +10:00
parent a56a926582
commit f9e33ec6b8
10 changed files with 80 additions and 43 deletions

View File

@ -19,17 +19,9 @@ class TopicsController < ApplicationController
before_filter :consider_user_for_promotion, only: :show
skip_before_filter :check_xhr, only: [:avatar, :show, :feed, :short_link]
skip_before_filter :store_incoming_links, only: [:short_link]
skip_before_filter :check_xhr, only: [:avatar, :show, :feed]
caches_action :avatar, cache_path: Proc.new {|c| "#{c.params[:post_number]}-#{c.params[:topic_id]}" }
def short_link
topic = Topic.find(params[:topic_id].to_i)
user = User.select(:id).where(id: params[:user_id].to_i).first
IncomingLink.add(request, user ? user.id : nil)
redirect_to topic.relative_url
end
def show
create_topic_view