Sha256: 0d27872d12a08c9404eac6cf65334d64949cff0a2456af3c61f430121ee16a8a

Contents?: true

Size: 828 Bytes

Versions: 40

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    class NotifyProposalsMentionedJob < ApplicationJob
      def perform(comment_id, linked_proposals)
        comment = Decidim::Comments::Comment.find(comment_id)

        linked_proposals.each do |proposal_id|
          proposal = Proposal.find(proposal_id)
          affected_users = proposal.notifiable_identities

          Decidim::EventsManager.publish(
            event: "decidim.events.proposals.proposal_mentioned",
            event_class: Decidim::Proposals::ProposalMentionedEvent,
            resource: comment.root_commentable,
            affected_users: affected_users,
            extra: {
              comment_id: comment.id,
              mentioned_proposal_id: proposal_id
            }
          )
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
decidim-proposals-0.27.0.rc1 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.1 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.0 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.0.rc2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.0.rc1 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.25.2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.25.1 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.25.0 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.25.0.rc4 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.25.0.rc3 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.25.0.rc2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.25.0.rc1 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.24.3 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.23.6 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.24.2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.23.5 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.24.1 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.24.0 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.24.0.rc2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb