Class: Decidim::Comments::CommentableMutationType
- Inherits:
-
Api::Types::BaseObject
- Object
- GraphQL::Schema::Object
- Api::Types::BaseObject
- Decidim::Comments::CommentableMutationType
- Defined in:
- decidim-comments/lib/decidim/api/commentable_mutation_type.rb
Instance Method Summary collapse
Methods inherited from Api::Types::BaseObject
allowed_to?, authorized?, determine_subject_name, local_admin_context, local_context, permission_chain
Instance Method Details
#add_comment(body:, alignment: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'decidim-comments/lib/decidim/api/commentable_mutation_type.rb', line 14 def add_comment(body:, alignment: nil) params = { "comment" => { "body" => body, "alignment" => alignment, "commentable" => object } } form = Decidim::Comments::CommentForm.from_params(params).with_context( current_organization: context[:current_organization], current_user: context[:current_user], current_component: object.component ) Decidim::Comments::CreateComment.call(form) do on(:ok) do |comment| return comment end end end |