Sha256: 672ef866ff5a9b593a338febb98eb5db61f174e6a3cebe0aa8b881789ce9e220

Contents?: true

Size: 847 Bytes

Versions: 18

Compression:

Stored size: 847 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 - [comment.author]

          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

18 entries across 18 versions & 1 rubygems

Version Path
decidim-proposals-0.27.9 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.8 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.7 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.6 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.10 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.9 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.5 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.8 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.4 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.3 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.7 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.5 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.1 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.4 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.0 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.26.3 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb
decidim-proposals-0.27.0.rc2 app/jobs/decidim/proposals/notify_proposals_mentioned_job.rb