mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: external links in whisper ended up in a white page
FIX: clicking a link in a onebox wasn't properly extracting the post_id
This commit is contained in:
@@ -12,9 +12,14 @@ class ClicksController < ApplicationController
|
||||
@redirect_url = TopicLinkClick.create_from(params)
|
||||
end
|
||||
|
||||
# Sometimes we want to record a link without a 302. Since XHR has to load the redirected
|
||||
# URL we want it to not return a 302 in those cases.
|
||||
if params[:redirect] == 'false' || @redirect_url.blank?
|
||||
# links in whispers aren't extracted, just allow the redirection to staff
|
||||
if @redirect_url.blank? && current_user&.staff? && params[:post_id].present?
|
||||
@redirect_url = params[:url] if Post.exists?(id: params[:post_id], post_type: Post.types[:whisper])
|
||||
end
|
||||
|
||||
# Sometimes we want to record a link without a 302.
|
||||
# Since XHR has to load the redirected URL we want it to not return a 302 in those cases.
|
||||
if params[:redirect] == "false" || @redirect_url.blank?
|
||||
render body: nil
|
||||
else
|
||||
redirect_to(@redirect_url)
|
||||
|
||||
Reference in New Issue
Block a user