FEATURE: better unfurling of Discourse topics on Slack

This commit is contained in:
Arpit Jalan
2015-12-28 18:22:31 +05:30
parent 0fdac4fc42
commit 6ef1537ee0
5 changed files with 25 additions and 2 deletions

View File

@@ -159,6 +159,16 @@ class TopicView
(excerpt || "").gsub(/\n/, ' ').strip
end
def read_time
return nil if @post_number.present? && @post_number.to_i != 1 # only show for topic URLs
(@topic.word_count/500).floor if @topic.word_count
end
def like_count
return nil if @post_number.present? && @post_number.to_i != 1 # only show for topic URLs
@topic.like_count
end
def image_url
@topic.image_url || SiteSetting.default_opengraph_image_url
end