Sha256: 1a0935442fc9f601361fcc0177b011d56345aa345fb7b4acf0d3c481746ac5ce

Contents?: true

Size: 1.18 KB

Versions: 22

Compression:

Stored size: 1.18 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
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
decidim-proposals-0.17.2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.17.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.16.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.17.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.16.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.15.2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.15.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.15.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.14.4 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.14.3 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.14.2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.14.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.13.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.12.2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.13.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.12.1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.13.0.pre1 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.12.0 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.11.2 lib/decidim/proposals/commentable_proposal.rb
decidim-proposals-0.12.0.pre lib/decidim/proposals/commentable_proposal.rb