-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AO3-6268 Fix All challenge owners/moderators get CCed in "Assignments sent" notification #4912
base: master
Are you sure you want to change the base?
Changes from 4 commits
25e6ed1
fdfca33
c8d8fe2
7fb0d0b
7b51ffd
d4da2da
1f0242e
f9e91ce
5e92d68
a4f6c63
85681cb
13bd956
cde3a74
047a875
450dbeb
c28acc5
ec338b0
e05c37b
ff9a9c0
e86c8a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -374,7 +374,10 @@ def self.delayed_generate(collection_id) | |
end | ||
end | ||
REDIS_GENERAL.del(progress_key(collection)) | ||
UserMailer.potential_match_generation_notification(collection.id).deliver_later | ||
@maintainers = collection.maintainers_list | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this accessed somewhere later? If not, I think this shouldn't be assigned to an instance variable. |
||
@maintainers.each do |i| | ||
UserMailer.potential_match_generation_notification(collection.id, i.email).deliver_later | ||
end | ||
end | ||
|
||
# go through the request's potential matches in order from best to worst and try and assign | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -334,15 +334,16 @@ def prompt_meme? | |||||
return self.challenge_type == "PromptMeme" | ||||||
end | ||||||
|
||||||
def get_maintainers_email | ||||||
return self.email if !self.email.blank? | ||||||
return parent.email if parent && !parent.email.blank? | ||||||
Comment on lines
-338
to
-339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More annoying things, sorry. These two lines of code are also needed for all the changed collection email sending. So if the collection email or parent collection email are set, send an untranslated email there. If not, send individual emails to all maintainers translated to the language they have selected. |
||||||
"#{self.maintainers.collect(&:user).flatten.uniq.collect(&:email).join(',')}" | ||||||
def maintainers_list | ||||||
@maintainers_list = self.maintainers.collect(&:user).flatten.uniq | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't this just be returned instead of setting an instance variable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This both sets it as an instance variable and returns it. Rubocop complains about an unnecessary return when I return without setting the instance variable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think rubocop might complain about an extra
Suggested change
|
||||||
end | ||||||
|
||||||
def notify_maintainers(subject, message) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit of an annoying thing: The subject and message currently have their Maybe they could even be moved to be directly in the UserMailer method. |
||||||
# send maintainers a notice via email | ||||||
UserMailer.collection_notification(self.id, subject, message).deliver_later | ||||||
@maintainers = self.maintainers_list | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this accessed somewhere later? If not, I think this shouldn't be assigned to an instance variable. |
||||||
# loop through maintainers and send each a notice via email | ||||||
@maintainers.each do |i| | ||||||
UserMailer.collection_notification(self.id, subject, message, i.email).deliver_later | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To fulfill the Jira issue, please wrap this in a |
||||||
end | ||||||
end | ||||||
|
||||||
include AsyncWithResque | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,9 +90,12 @@ def self.generate_in_background(collection_id) | |
# check for invalid signups | ||
PotentialMatch.clear_invalid_signups(collection) | ||
invalid_signup_ids = collection.signups.select {|s| !s.valid?}.collect(&:id) | ||
unless invalid_signup_ids.empty? | ||
if invalid_signup_ids.present? | ||
invalid_signup_ids.each {|sid| REDIS_GENERAL.sadd invalid_signup_key(collection), sid} | ||
UserMailer.invalid_signup_notification(collection.id, invalid_signup_ids).deliver_later | ||
@maintainers = collection.maintainers_list | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this accessed somewhere later? If not, I think this shouldn't be assigned to an instance variable. |
||
@maintainers.each do |i| | ||
UserMailer.invalid_signup_notification(collection.id, invalid_signup_ids, i.email).deliver_later | ||
end | ||
PotentialMatch.cancel_generation(collection) | ||
else | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -933,7 +933,7 @@ | |
end | ||
|
||
describe "potential_match_generation_notification" do | ||
subject(:email) { UserMailer.potential_match_generation_notification(collection.id) } | ||
subject(:email) { UserMailer.potential_match_generation_notification(collection.id, "[email protected]") } | ||
|
||
let(:collection) { create(:collection) } | ||
|
||
|
@@ -966,7 +966,7 @@ | |
end | ||
|
||
describe "invalid_signup_notification" do | ||
subject(:email) { UserMailer.invalid_signup_notification(collection.id, [signup.id]) } | ||
subject(:email) { UserMailer.invalid_signup_notification(collection.id, [signup.id], "[email protected]") } | ||
|
||
let(:collection) { create(:collection) } | ||
let(:signup) { create(:challenge_signup) } | ||
|
@@ -998,7 +998,7 @@ | |
end | ||
|
||
describe "collection_notification" do | ||
subject(:email) { UserMailer.collection_notification(collection.id, subject_text, message_text) } | ||
subject(:email) { UserMailer.collection_notification(collection.id, subject_text, message_text, "[email protected]") } | ||
|
||
let(:collection) { create(:collection) } | ||
let(:subject_text) { Faker::Hipster.sentence } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Regarding your comment on Jira, this is the related issue: The subject locale should include the whole string with the placeholders for the short_name and the collection title, not just the last part.
But not relevant for this PR.)