Sha256: ad020326aa6bf83d19ed76e9a238818f75e08e90bab34ce66718d21cee3b8a1a

Contents?: true

Size: 697 Bytes

Versions: 3

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This interface represents a commentable object.
    AuthorableInterface = GraphQL::InterfaceType.define do
      name "AuthorableInterface"
      description "An interface that can be used in authorable objects."

      field :author, !Decidim::Core::AuthorInterface, "The comment's author" do
        # can be an Authorable or a Coauthorable
        resolve ->(authorable, _, _) {
          if authorable.respond_to?(:normalized_author)
            authorable&.normalized_author
          elsif authorable.respond_to?(:creator_identity)
            authorable&.creator_identity
          end
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-core-0.13.1 lib/decidim/api/authorable_interface.rb
decidim-core-0.13.0 lib/decidim/api/authorable_interface.rb
decidim-core-0.13.0.pre1 lib/decidim/api/authorable_interface.rb