Skip to content

Commit

Permalink
Hotfix: Prevent email reminders from going out beyond the committee r…
Browse files Browse the repository at this point in the history
…eview stage (#721)

* Prevent email reminders when committee member has any kind of vote and when the submission status is waiting for committee review rejected

* Expand this a bit to prevent emails going out beyond waiting for head of program review.  This includes when the committee rejected.
  • Loading branch information
ajkiessl authored Feb 14, 2024
1 parent fd27960 commit 3cde617
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/workers/committee_reminder_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def perform(submission_id, committee_member_id)

return unless committee_member.reminder_email_authorized?

return if committee_member.status == 'approved' || committee_member.status == 'rejected'
return if committee_member.status.present? || submission.status_behavior.beyond_waiting_for_head_of_program_review?

WorkflowMailer.send_committee_review_reminders(submission, committee_member)
end
Expand Down
23 changes: 22 additions & 1 deletion spec/workers/committee_reminder_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,33 @@
end
end

context "when committee member already accepted or rejected" do
context "when committee member already has a vote" do
it 'does not deliver an email' do
committee_member.update_attribute :status, 'approved'
Sidekiq::Testing.inline! do
expect { described_class.perform_async(submission.id, committee_member.id) }.to change { WorkflowMailer.deliveries.size }.by(0)
end
committee_member.update_attribute :status, 'rejected'
Sidekiq::Testing.inline! do
expect { described_class.perform_async(submission.id, committee_member.id) }.to change { WorkflowMailer.deliveries.size }.by(0)
end
committee_member.update_attribute :status, 'did not vote'
Sidekiq::Testing.inline! do
expect { described_class.perform_async(submission.id, committee_member.id) }.to change { WorkflowMailer.deliveries.size }.by(0)
end
end
end

context "when submission is beyond_waiting_for_head_of_program_review?" do
it 'does not deliver an email' do
submission.update status: 'waiting for committee review rejected'
Sidekiq::Testing.inline! do
expect { described_class.perform_async(submission.id, committee_member.id) }.to change { WorkflowMailer.deliveries.size }.by(0)
end
submission.update status: 'waiting for final submission response'
Sidekiq::Testing.inline! do
expect { described_class.perform_async(submission.id, committee_member.id) }.to change { WorkflowMailer.deliveries.size }.by(0)
end
end
end

Expand Down

0 comments on commit 3cde617

Please sign in to comment.