Module: Decidim::Comments::CommentableInterface

Includes:
Api::Types::BaseInterface
Defined in:
decidim-comments/lib/decidim/api/commentable_interface.rb

Overview

This interface represents a commentable object.

Instance Method Summary collapse

Instance Method Details

#comments(order_by: nil, single_comment_id: nil) ⇒ Object



23
24
25
# File 'decidim-comments/lib/decidim/api/commentable_interface.rb', line 23

def comments(order_by: nil, single_comment_id: nil)
  SortedComments.for(object, order_by:, id: single_comment_id).not_hidden
end

#user_allowed_to_commentObject



27
28
29
# File 'decidim-comments/lib/decidim/api/commentable_interface.rb', line 27

def user_allowed_to_comment
  object.commentable? && object.user_allowed_to_comment?(context[:current_user])
end