Skip to content

Commit

Permalink
FIX: handle embed count when topic not found
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitjalan committed Aug 25, 2016
1 parent 87f6aad commit bfefda0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/embed_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def count
topic_embeds.each do |te|
url = te.embed_url
url = "#{url}#discourse-comments" unless params[:embed_url].include?(url)
by_url[url] = I18n.t('embed.replies', count: te.topic.posts_count - 1)
if te.topic.present?
by_url[url] = I18n.t('embed.replies', count: te.topic.posts_count - 1)
else
by_url[url] = I18n.t('embed.replies', count: 0)
end
end
end

Expand Down

0 comments on commit bfefda0

Please sign in to comment.