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.29.1 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.28.4 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.9 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.29.0 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.28.3 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.8 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.29.0.rc4 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.29.0.rc3 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.29.0.rc2 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.29.0.rc1 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.28.2 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.7 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.28.1 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.6 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.28.0 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.5 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.28.0.rc5 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.28.0.rc4 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.4 lib/decidim/api/interfaces/authorable_interface.rb
decidim-core-0.27.3 lib/decidim/api/interfaces/authorable_interface.rb