mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: Allow embedding topics without creating them, by id
This commit is contained in:
@ -1,13 +1,18 @@
|
||||
class EmbedController < ApplicationController
|
||||
skip_before_filter :check_xhr, :preload_json, :verify_authenticity_token
|
||||
|
||||
before_filter :ensure_embeddable
|
||||
|
||||
layout 'embed'
|
||||
|
||||
def comments
|
||||
embed_url = params.require(:embed_url)
|
||||
topic_id = TopicEmbed.topic_id_for_embed(embed_url)
|
||||
embed_url = params[:embed_url]
|
||||
|
||||
topic_id = nil
|
||||
if embed_url.present?
|
||||
topic_id = TopicEmbed.topic_id_for_embed(embed_url)
|
||||
else
|
||||
topic_id = params[:topic_id].to_i
|
||||
end
|
||||
|
||||
if topic_id
|
||||
@topic_view = TopicView.new(topic_id,
|
||||
@ -21,7 +26,8 @@ class EmbedController < ApplicationController
|
||||
if @topic_view && @topic_view.posts.size == SiteSetting.embed_post_limit
|
||||
@posts_left = @topic_view.topic.posts_count - SiteSetting.embed_post_limit - 1
|
||||
end
|
||||
else
|
||||
|
||||
elsif embed_url.present?
|
||||
Jobs.enqueue(:retrieve_topic, user_id: current_user.try(:id), embed_url: embed_url)
|
||||
render 'loading'
|
||||
end
|
||||
@ -30,7 +36,6 @@ class EmbedController < ApplicationController
|
||||
end
|
||||
|
||||
def count
|
||||
|
||||
embed_urls = params[:embed_url]
|
||||
by_url = {}
|
||||
|
||||
|
Reference in New Issue
Block a user