class Decidim::Comments::CommentType
This type represents a comment on a commentable object.
Public Instance Methods
already_reported()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 80 def already_reported object.reported_by?(context[:current_user]) end
body()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 48 def body object.translated_body end
created_at()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 52 def created_at object.created_at.iso8601 end
down_voted()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 72 def down_voted object.down_voted_by?(context[:current_user]) end
down_votes()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 68 def down_votes object.down_votes.size end
formatted_created_at()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 56 def formatted_created_at object.friendly_created_at end
has_comments?()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 76 def has_comments? object.comment_threads.size.positive? end
sgid()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 44 def sgid object.to_sgid.to_s end
up_voted()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 64 def up_voted object.up_voted_by?(context[:current_user]) end
up_votes()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 60 def up_votes object.up_votes.size end
user_allowed_to_comment()
click to toggle source
# File lib/decidim/api/comment_type.rb, line 84 def user_allowed_to_comment object.root_commentable.commentable? && object.root_commentable.user_allowed_to_comment?(context[:current_user]) end