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.29.1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.28.4 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.27.9 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.29.0 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.28.3 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.27.8 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.29.0.rc4 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.29.0.rc3 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.29.0.rc2 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.29.0.rc1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.28.2 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.27.7 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.28.1 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.27.6 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.26.10 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.26.9 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.28.0 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.27.5 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.28.0.rc5 app/services/decidim/initiatives/progress_notifier.rb
decidim-initiatives-0.28.0.rc4 app/services/decidim/initiatives/progress_notifier.rb