-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: disable some emails to admin & user (#1568)
* chore: disable emails to admin address (sell@) * chore: disable submission emails to users
- Loading branch information
1 parent
fc03aec
commit f9b4610
Showing
5 changed files
with
96 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,15 +125,15 @@ | |
expect(response.status).to eq 201 | ||
expect(@submission.reload.receipt_sent_at).to_not be_nil | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 3 | ||
expect(emails.length).to eq 1 | ||
admin_email = emails.detect { |e| e.to.include?("[email protected]") } | ||
admin_copy = "We have received the following submission from: Jon" | ||
expect(admin_email.html_part.body.to_s).to include(admin_copy) | ||
expect(admin_email.text_part.body.to_s).to include(admin_copy) | ||
expect(admin_email).to be_nil | ||
# admin_copy = "We have received the following submission from: Jon" | ||
# expect(admin_email.html_part.body.to_s).to include(admin_copy) | ||
# expect(admin_email.text_part.body.to_s).to include(admin_copy) | ||
|
||
user_email = emails.detect { |e| e.to.include?("[email protected]") } | ||
user_copy = | ||
"to evaluate whether we currently have a suitable market for it" | ||
user_copy = "not accepting consignments" | ||
expect(user_email.html_part.body.to_s).to include(user_copy) | ||
expect(user_email.text_part.body.to_s).to include(user_copy) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,10 +51,10 @@ | |
expect(submission.reload.state).to eq "submitted" | ||
|
||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 4 | ||
expect(emails[1].to).to eq(%w[[email protected]]) | ||
expect(emails[1].subject).to include("You're Almost Done") | ||
expect(emails[2].to).to eq(%w[[email protected]]) # sidekiq flushes everything at once | ||
expect(emails.length).to eq 3 | ||
expect(emails[0].to).to eq(%w[[email protected]]) | ||
expect(emails[0].subject).to include("You're Almost Done") | ||
expect(emails[1].to).to eq(%w[[email protected]]) # sidekiq flushes everything at once | ||
expect(emails.map(&:subject)).to include( | ||
"Artsy Consignments - complete your submission" | ||
) | ||
|
@@ -97,10 +97,10 @@ | |
expect(response.status).to eq 201 | ||
expect(@submission.reload.state).to eq "submitted" | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 4 | ||
expect(emails[1].to).to eq(%w[[email protected]]) | ||
expect(emails[1].subject).to include("You're Almost Done") | ||
expect(emails[2].to).to eq(%w[[email protected]]) # sidekiq flushes everything at once | ||
expect(emails.length).to eq 3 | ||
expect(emails[0].to).to eq(%w[[email protected]]) | ||
expect(emails[0].subject).to include("You're Almost Done") | ||
expect(emails[1].to).to eq(%w[[email protected]]) # sidekiq flushes everything at once | ||
expect(emails.map(&:subject)).to include( | ||
"Artsy Consignments - complete your submission" | ||
) | ||
|
@@ -190,8 +190,8 @@ | |
expect(response.status).to eq 201 | ||
expect(submission.reload.state).to eq "submitted" | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 3 | ||
expect(emails[1].html_part.body).to include("https://new-image.jpg") | ||
expect(emails.length).to eq 1 | ||
# expect(emails[0].html_part.body).to include("https://new-image.jpg") | ||
|
||
# GET to retrieve the image url for the submission | ||
get "/api/assets", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -328,7 +328,7 @@ | |
.with(submission.id, "submitted") | ||
SubmissionService.update_submission(submission, {state: "submitted"}) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 4 | ||
expect(emails.length).to eq 3 | ||
end | ||
|
||
it "sends no reminders if the submission has images" do | ||
|
@@ -338,7 +338,7 @@ | |
Fabricate(:image, submission: submission) | ||
SubmissionService.update_submission(submission, {state: "submitted"}) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 3 | ||
expect(emails.length).to eq 1 | ||
end | ||
|
||
it "sends no emails if the state is not being changed" do | ||
|
@@ -1078,22 +1078,22 @@ | |
it "sends a receipt" do | ||
SubmissionService.notify_user(submission.id) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 1 | ||
expect(emails.first.html_part.body).to include( | ||
"Our team of specialists will review your work to evaluate whether we currently have a suitable market for it. If your work is accepted, we’ll send you a sales offer and guide you in choosing the best option for selling it." | ||
) | ||
expect(emails.first.to).to eq(%w[[email protected]]) | ||
expect(submission.reload.receipt_sent_at).to_not be nil | ||
expect(emails.length).to eq 0 | ||
# expect(emails.first.html_part.body).to include( | ||
# "Our team of specialists will review your work to evaluate whether we currently have a suitable market for it. If your work is accepted, we’ll send you a sales offer and guide you in choosing the best option for selling it." | ||
# ) | ||
# expect(emails.first.to).to eq(%w[[email protected]]) | ||
# expect(submission.reload.receipt_sent_at).to_not be nil | ||
end | ||
|
||
it "sends a receipt without a prompt to create an Artsy account for user submissions" do | ||
SubmissionService.notify_user(submission.id) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 1 | ||
expect(emails.first.html_part.body).to_not include( | ||
"find your artwork in" | ||
) | ||
expect(submission.reload.receipt_sent_at).to_not be nil | ||
expect(emails.length).to eq 0 | ||
# expect(emails.first.html_part.body).to_not include( | ||
# "find your artwork in" | ||
# ) | ||
# expect(submission.reload.receipt_sent_at).to_not be nil | ||
end | ||
|
||
it "does not send a receipt if one has already been sent" do | ||
|
@@ -1186,10 +1186,9 @@ | |
) | ||
SubmissionService.notify_user(submission.id) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 1 | ||
|
||
expect(emails.first.html_part.body).to include("find your artwork in") | ||
expect(submission.reload.receipt_sent_at).to_not be nil | ||
expect(emails.length).to eq 0 | ||
# expect(emails.first.html_part.body).to include("find your artwork in") | ||
# expect(submission.reload.receipt_sent_at).to_not be nil | ||
end | ||
|
||
it "does not send a receipt with a prompt to create an Artsy account when config does not allow" do | ||
|
@@ -1198,10 +1197,9 @@ | |
) | ||
SubmissionService.notify_user(submission.id) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 1 | ||
|
||
expect(emails.first.html_part.body).to_not include("find your artwork in") | ||
expect(submission.reload.receipt_sent_at).to_not be nil | ||
expect(emails.length).to eq 0 | ||
# expect(emails.first.html_part.body).to_not include("find your artwork in") | ||
# expect(submission.reload.receipt_sent_at).to_not be nil | ||
end | ||
end | ||
|
||
|
@@ -1212,10 +1210,10 @@ | |
.with(submission.id, "submitted") | ||
SubmissionService.notify_admin(submission.id) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 1 | ||
expect(emails.first.html_part.body).to include("My Artwork") | ||
expect(emails.first.to).to eq(%w[[email protected]]) | ||
expect(submission.reload.admin_receipt_sent_at).to_not be nil | ||
expect(emails.length).to eq 0 | ||
# expect(emails.first.html_part.body).to include("My Artwork") | ||
# expect(emails.first.to).to eq(%w[[email protected]]) | ||
# expect(submission.reload.admin_receipt_sent_at).to_not be nil | ||
end | ||
|
||
it "does not send an email if one has already been sent" do | ||
|
@@ -1256,19 +1254,19 @@ | |
SubmissionService.deliver_submission_receipt(submission.id) | ||
emails = ActionMailer::Base.deliveries | ||
|
||
expect(emails.length).to eq 1 | ||
expect(emails.first.bcc).to include("[email protected]") | ||
expect(emails.first.html_part.body).to include( | ||
"Thank you for submitting an artwork" | ||
) | ||
expect(emails.first.html_part.body).to include( | ||
"Our team of specialists will review your work to evaluate whether we currently have a suitable market for it" | ||
) | ||
|
||
expect(emails.first.html_part.body).to include("utm_source=sendgrid") | ||
expect(emails.first.html_part.body).to include("utm_medium=email") | ||
expect(emails.first.html_part.body).to include("utm_campaign=sell") | ||
expect(emails.first.html_part.body).to include("utm_content=received") | ||
expect(emails.length).to eq 0 | ||
# expect(emails.first.bcc).to include("[email protected]") | ||
# expect(emails.first.html_part.body).to include( | ||
# "Thank you for submitting an artwork" | ||
# ) | ||
# expect(emails.first.html_part.body).to include( | ||
# "Our team of specialists will review your work to evaluate whether we currently have a suitable market for it" | ||
# ) | ||
|
||
# expect(emails.first.html_part.body).to include("utm_source=sendgrid") | ||
# expect(emails.first.html_part.body).to include("utm_medium=email") | ||
# expect(emails.first.html_part.body).to include("utm_campaign=sell") | ||
# expect(emails.first.html_part.body).to include("utm_content=received") | ||
end | ||
end | ||
|
||
|
@@ -1298,8 +1296,8 @@ | |
Fabricate(:unprocessed_image, submission: submission) | ||
SubmissionService.deliver_submission_notification(submission.id) | ||
emails = ActionMailer::Base.deliveries | ||
expect(emails.length).to eq 1 | ||
expect(emails.first.html_part.body).to include("My Artwork") | ||
expect(emails.length).to eq 0 | ||
# expect(emails.first.html_part.body).to include("My Artwork") | ||
end | ||
end | ||
end |