app/cells/decidim/comments/comment_cell.rb in decidim-comments-0.28.0 vs app/cells/decidim/comments/comment_cell.rb in decidim-comments-0.28.1
- old
+ new
@@ -45,10 +45,12 @@
hash = []
hash.push(I18n.locale)
hash.push(model.must_render_translation?(current_organization) ? 1 : 0)
hash.push(model.authored_by?(current_user) ? 1 : 0)
hash.push(model.reported_by?(current_user) ? 1 : 0)
+ hash.push(model.up_votes_count)
+ hash.push(model.down_votes_count)
hash.push(model.cache_key_with_version)
hash.push(model.author.cache_key_with_version)
@hash = hash.join(Decidim.cache_key_separator)
end
@@ -135,15 +137,15 @@
def comment_path
decidim_comments.comment_path(model)
end
def up_votes_count
- model.up_votes.count
+ model.up_votes_count
end
def down_votes_count
- model.down_votes.count
+ model.down_votes_count
end
def root_depth
options[:root_depth] || 0
end
@@ -155,14 +157,14 @@
def reloaded?
options[:reloaded]
end
def voted_up?
- model.up_voted_by?(current_user)
+ @up_voted ||= model.up_voted_by?(current_user)
end
def voted_down?
- model.down_voted_by?(current_user)
+ @down_voted ||= model.down_voted_by?(current_user)
end
def nested?
depth.positive?
end