|
1class NotifyEveryoneOfModerationDecisionJob < ApplicationJob
|
|
2 rescue_from StandardError do |exception|
|
|
3 Appsignal.send_exception exception
|
|
|
|
|
- FeatureEnvy - refers to 'petition' more than self (maybe move it to another class?) » reek
- Complexity 3 » saikuro
|
|
|
7 creator = petition.creator
|
|
8 sponsors = petition.sponsors.validated
|
|
|
|
10 if petition.published?
|
|
11 notify_everyone_of_publication(creator, sponsors)
|
|
12 elsif petition.rejected? || petition.hidden?
|
|
13 notify_everyone_of_rejection(creator, sponsors)
|
|
|
|
|
|
|
|
|
|
|
- UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
- Complexity 2 » saikuro
|
19 def notify_everyone_of_publication(creator, sponsors)
|
|
20 NotifyCreatorThatPetitionIsPublishedEmailJob.perform_later(creator)
|
|
|
|
22 sponsors.each do |sponsor|
|
|
23 NotifySponsorThatPetitionIsPublishedEmailJob.perform_later(sponsor)
|
|
|
|
|
|
|
- UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
- Complexity 2 » saikuro
|
27 def notify_everyone_of_rejection(creator, sponsors)
|
|
28 NotifyCreatorThatPetitionWasRejectedEmailJob.perform_later(creator)
|
|
|
|
30 sponsors.each do |sponsor|
|
|
31 NotifySponsorThatPetitionWasRejectedEmailJob.perform_later(sponsor)
|
|
|
|
|
|
|