class Decidim::Comments::CommentableMutationType
Public Instance Methods
add_comment(body:, alignment: nil, user_group_id: nil)
click to toggle source
# File lib/decidim/api/commentable_mutation_type.rb, line 16 def add_comment(body:, alignment: nil, user_group_id: nil) params = { "comment" => { "body" => body, "alignment" => alignment, "user_group_id" => user_group_id, "commentable" => object } } form = Decidim::Comments::CommentForm.from_params(params).with_context( current_organization: context[:current_organization], current_component: object.component ) Decidim::Comments::CreateComment.call(form, context[:current_user]) do on(:ok) do |comment| return comment end end end