class Decidim::DummyResources::DummyResource

Public Class Methods

export_serializer() click to toggle source
# File lib/decidim/dev/test/rspec_support/component.rb, line 122
def self.export_serializer
  DummySerializer
end
newsletter_participant_ids(component) click to toggle source
# File lib/decidim/dev/test/rspec_support/component.rb, line 126
def self.newsletter_participant_ids(component)
  authors_ids = Decidim::DummyResources::DummyResource.where(component: component)
                                                      .where(decidim_author_type: Decidim::UserBaseEntity.name)
                                                      .where.not(author: nil)
                                                      .group(:decidim_author_id)
                                                      .pluck(:decidim_author_id)
  commentators_ids = Decidim::Comments::Comment.user_commentators_ids_in(Decidim::DummyResources::DummyResource.where(component: component))
  (authors_ids + commentators_ids).flatten.compact.uniq
end
user_collection(user) click to toggle source
# File lib/decidim/dev/test/rspec_support/component.rb, line 118
def self.user_collection(user)
  where(decidim_author_id: user.id, decidim_author_type: "Decidim::User")
end

Public Instance Methods

allow_resource_permissions?() click to toggle source
# File lib/decidim/dev/test/rspec_support/component.rb, line 104
def allow_resource_permissions?
  component.settings.resources_permissions_enabled
end
commentable?() click to toggle source

Public: Overrides the `commentable?` Commentable concern method.

# File lib/decidim/dev/test/rspec_support/component.rb, line 109
def commentable?
  component.settings.comments_enabled?
end
reported_attributes() click to toggle source
# File lib/decidim/dev/test/rspec_support/component.rb, line 96
def reported_attributes
  [:title]
end
reported_content_url() click to toggle source
# File lib/decidim/dev/test/rspec_support/component.rb, line 92
def reported_content_url
  ResourceLocatorPresenter.new(self).url
end
reported_searchable_content_extras() click to toggle source
# File lib/decidim/dev/test/rspec_support/component.rb, line 100
def reported_searchable_content_extras
  [normalized_author.name]
end
user_allowed_to_comment?(user) click to toggle source

Public: Whether the object can have new comments or not.

# File lib/decidim/dev/test/rspec_support/component.rb, line 114
def user_allowed_to_comment?(user)
  component.can_participate_in_space?(user)
end