mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Never show less than 0 replies when embedding
This commit is contained in:
parent
6ec336e56f
commit
5056de1d8a
2 changed files with 4 additions and 1 deletions
|
@ -29,6 +29,9 @@ class EmbedController < ApplicationController
|
||||||
@posts_left = @topic_view.topic.posts_count - SiteSetting.embed_post_limit - 1
|
@posts_left = @topic_view.topic.posts_count - SiteSetting.embed_post_limit - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@reply_count = @topic_view.topic.posts_count - 1
|
||||||
|
@reply_count = 0 if @reply_count < 0
|
||||||
|
|
||||||
elsif embed_url.present?
|
elsif embed_url.present?
|
||||||
Jobs.enqueue(:retrieve_topic, user_id: current_user.try(:id), embed_url: embed_url)
|
Jobs.enqueue(:retrieve_topic, user_id: current_user.try(:id), embed_url: embed_url)
|
||||||
render 'loading'
|
render 'loading'
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<% elsif @topic_view.topic.posts_count > 10 %>
|
<% elsif @topic_view.topic.posts_count > 10 %>
|
||||||
<%= link_to(I18n.t('embed.continue'), @second_post_url, class: 'button', target: '_blank') %>
|
<%= link_to(I18n.t('embed.continue'), @second_post_url, class: 'button', target: '_blank') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class='replies'><%= I18n.t('embed.replies', count: @topic_view.topic.posts_count - 1) %></span>
|
<span class='replies'><%= I18n.t('embed.replies', count: @reply_count) %></span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<%- if @topic_view.posts.present? %>
|
<%- if @topic_view.posts.present? %>
|
||||||
|
|
Loading…
Reference in a new issue