diff --git a/app/controllers/embed_controller.rb b/app/controllers/embed_controller.rb index 843a95092..6a6ded4cb 100644 --- a/app/controllers/embed_controller.rb +++ b/app/controllers/embed_controller.rb @@ -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' diff --git a/app/views/embed/comments.html.erb b/app/views/embed/comments.html.erb index 511d401fe..873229a99 100644 --- a/app/views/embed/comments.html.erb +++ b/app/views/embed/comments.html.erb @@ -4,7 +4,7 @@ <% elsif @topic_view.topic.posts_count > 10 %> <%= link_to(I18n.t('embed.continue'), @second_post_url, class: 'button', target: '_blank') %> <% end %> - <%= I18n.t('embed.replies', count: @topic_view.topic.posts_count - 1) %> + <%= I18n.t('embed.replies', count: @reply_count) %> <%- if @topic_view.posts.present? %>