Sha256: d00e3c73ed24f9c392356ce97e6a850b147cc78b58e2866f7b6ef838d2f26b14

Contents?: true

Size: 1.03 KB

Versions: 88

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # Service that notifies progress for an initiative
    class ProgressNotifier
      attr_reader :initiative

      def initialize(args = {})
        @initiative = args.fetch(:initiative)
      end

      # PUBLIC: Notifies the support progress of the initiative.
      #
      # Notifies to Initiative's authors and followers about the
      # number of supports received by the initiative.
      def notify
        initiative.followers.each do |follower|
          Decidim::Initiatives::InitiativesMailer
            .notify_progress(initiative, follower)
            .deliver_later
        end

        initiative.committee_members.approved.each do |committee_member|
          Decidim::Initiatives::InitiativesMailer
            .notify_progress(initiative, committee_member.user)
            .deliver_later
        end

        Decidim::Initiatives::InitiativesMailer
          .notify_progress(initiative, initiative.author)
          .deliver_later
      end
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
decidim-initiatives-0.25.0.rc4 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.25.0.rc3 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.25.0.rc2 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.25.0.rc1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.24.3 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.6 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.24.2 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.5 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.24.1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.24.0 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.24.0.rc2 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.4 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.24.0.rc1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.3 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.2 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.1.rc1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.23.0 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.22.0 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.21.0 app/services/decidim/initiatives/progress_notifier.rb