Don't do unnecessary processing on posts when using the API
This commit is contained in:
@@ -21,6 +21,7 @@ class PostsController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
@post = Post.find(params[:id])
|
@post = Post.find(params[:id])
|
||||||
|
|
||||||
|
if request.format == Mime::Type.lookup("text/html")
|
||||||
@comments = @post.comments
|
@comments = @post.comments
|
||||||
@comments = @comments.includes(:creator)
|
@comments = @comments.includes(:creator)
|
||||||
@comments = @comments.includes(:votes) if CurrentUser.is_member?
|
@comments = @comments.includes(:votes) if CurrentUser.is_member?
|
||||||
@@ -32,6 +33,7 @@ class PostsController < ApplicationController
|
|||||||
|
|
||||||
@child_posts = @post.children
|
@child_posts = @post.children
|
||||||
@child_posts = @child_posts.undeleted unless include_deleted
|
@child_posts = @child_posts.undeleted unless include_deleted
|
||||||
|
end
|
||||||
|
|
||||||
respond_with(@post) do |format|
|
respond_with(@post) do |format|
|
||||||
format.html.tooltip { render layout: false }
|
format.html.tooltip { render layout: false }
|
||||||
|
|||||||
Reference in New Issue
Block a user