Sha256: 9d082614b85985f3b806fd6f9f654c07bad34caa0a04d6f6cf6908266d414098

Contents?: true

Size: 1.28 KB

Versions: 20

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    # The data store for a Proposal in the Decidim::Proposals component.
    module CommentableProposal
      extend ActiveSupport::Concern
      include Decidim::Comments::Commentable

      included do
        # Public: Overrides the `commentable?` Commentable concern method.
        def commentable?
          component.settings.comments_enabled?
        end

        # Public: Overrides the `accepts_new_comments?` Commentable concern method.
        def accepts_new_comments?
          commentable? && !component.current_settings.comments_blocked
        end

        # Public: Overrides the `comments_have_alignment?` Commentable concern method.
        def comments_have_alignment?
          true
        end

        # Public: Overrides the `comments_have_votes?` Commentable concern method.
        def comments_have_votes?
          true
        end

        # Public: Override Commentable concern method `users_to_notify_on_comment_created`
        def users_to_notify_on_comment_created
          return (followers | component.participatory_space.admins).uniq if official?

          followers
        end

        def user_allowed_to_comment?(user)
          can_participate_in_space?(user)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
decidim-proposals-0.24.3 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.6 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.24.2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.5 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.24.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.24.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.24.0.rc2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.4 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.24.0.rc1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.3 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.1.rc1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.23.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.22.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.21.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.20.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.20.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.19.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.19.0 lib/decidim/proposals/commentable_proposal.rb