FIX: handle embed count when topic not found

This commit is contained in:
Arpit Jalan 2016-08-25 06:57:00 +05:30
parent 87f6aadb7e
commit bfefda06f6

View file

@ -69,7 +69,11 @@ class EmbedController < ApplicationController
topic_embeds.each do |te|
url = te.embed_url
url = "#{url}#discourse-comments" unless params[:embed_url].include?(url)
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