FIX: Never show less than 0 replies when embedding

This commit is contained in:
Robin Ward
2015-11-20 13:05:45 -05:00
parent 6ec336e56f
commit 5056de1d8a
2 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,9 @@ class EmbedController < ApplicationController
@posts_left = @topic_view.topic.posts_count - SiteSetting.embed_post_limit - 1
end
@reply_count = @topic_view.topic.posts_count - 1
@reply_count = 0 if @reply_count < 0
elsif embed_url.present?
Jobs.enqueue(:retrieve_topic, user_id: current_user.try(:id), embed_url: embed_url)
render 'loading'