Sha256: b382dc13044766971ac8d8d7b3ea8b3b099f323c817afb0ba99c5ac2ee697d3e

Contents?: true

Size: 749 Bytes

Versions: 25

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This interface represents a commentable object.
    module AuthorableInterface
      include Decidim::Api::Types::BaseInterface
      description "An interface that can be used in authorable objects."

      field :author, Decidim::Core::AuthorInterface, "The resource author", null: true do
        # can be an Authorable or a Coauthorable
      end

      def author
        author = if object.respond_to?(:normalized_author)
                   object&.normalized_author
                 elsif object.respond_to?(:creator_identity)
                   object&.creator_identity
                 end
        author if author.is_a?(Decidim::UserBaseEntity)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
decidim-core-0.27.2 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.1 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.0 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.0.rc2 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.0.rc1 lib/decidim/api/interfaces/authorable_interface.rb