mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
Refactor: Move Topic Details into better objects, identity map, tests, query string filters
This commit is contained in:
@ -25,12 +25,11 @@ class TopicsController < ApplicationController
|
||||
caches_action :avatar, cache_path: Proc.new {|c| "#{c.params[:post_number]}-#{c.params[:topic_id]}" }
|
||||
|
||||
def show
|
||||
|
||||
# We'd like to migrate the wordpress feed to another url. This keeps up backwards compatibility with
|
||||
# existing installs.
|
||||
return wordpress if params[:best].present?
|
||||
|
||||
opts = params.slice(:username_filters, :best_of, :page, :post_number, :posts_before, :posts_after)
|
||||
opts = params.slice(:username_filters, :filter, :page, :post_number)
|
||||
begin
|
||||
@topic_view = TopicView.new(params[:id] || params[:topic_id], current_user, opts)
|
||||
rescue Discourse::NotFound
|
||||
@ -67,7 +66,15 @@ class TopicsController < ApplicationController
|
||||
wordpress_serializer = TopicViewWordpressSerializer.new(@topic_view, scope: guardian, root: false)
|
||||
render_json_dump(wordpress_serializer)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def posts
|
||||
params.require(:topic_id)
|
||||
params.require(:post_ids)
|
||||
|
||||
@topic_view = TopicView.new(params[:topic_id], current_user, post_ids: params[:post_ids])
|
||||
render_json_dump(TopicViewPostsSerializer.new(@topic_view, scope: guardian, root: false))
|
||||
end
|
||||
|
||||
def destroy_timings
|
||||
|
Reference in New Issue
Block a user