2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
class ClicksController < ApplicationController
|
2019-05-07 02:37:43 -04:00
|
|
|
skip_before_action :check_xhr, :preload_json, :verify_authenticity_token
|
2013-02-07 10:45:24 -05:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
def track
|
2019-04-23 05:41:36 -04:00
|
|
|
params.require(%i[url post_id topic_id])
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2019-04-23 05:41:36 -04:00
|
|
|
TopicLinkClick.create_from(
|
|
|
|
url: params[:url],
|
|
|
|
post_id: params[:post_id],
|
|
|
|
topic_id: params[:topic_id],
|
|
|
|
ip: request.remote_ip,
|
|
|
|
user_id: current_user&.id,
|
|
|
|
)
|
2013-06-06 03:14:32 -04:00
|
|
|
|
2019-04-23 05:41:36 -04:00
|
|
|
render json: success_json
|
2013-06-06 03:14:32 -04:00
|
|
|
end
|
2013-02-07 10:45:24 -05:00
|
|
|
end
|