-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add before_action in IncomingEmail webhook controller #4443
Changes from all commits
dc06ab9
724fca4
efd7b99
c76eb15
b751fed
fc2a529
99d847a
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
class ApplicationRecord < ActiveRecord::Base | ||
self.abstract_class = true | ||
|
||
STATE_INTAKE_CLASS_NAMES = %w[StateFileAzIntake StateFileNyIntake].map(&:to_s).freeze | ||
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. Moving this here to make it available to all our models instead of just |
||
# Allow counting up to a max number; see https://alexcastano.com/the-hidden-cost-of-the-invisible-queries-in-rails/#how-far-do-you-plan-to-count | ||
scope :count_greater_than?, ->(n) { limit(n + 1).count > n } | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -706,4 +706,17 @@ | |
end | ||
end | ||
end | ||
|
||
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. Adding this spec since I moved |
||
describe '#is_for_state_filing?' do | ||
let(:state_efile_submission) { create :efile_submission, :for_state } | ||
let(:non_state_efile_submission) { create :efile_submission } | ||
|
||
it 'returns true for state submission' do | ||
expect(state_efile_submission.is_for_state_filing?).to eq true | ||
end | ||
|
||
it 'returns false for non-state submission' do | ||
expect(non_state_efile_submission.is_for_state_filing?).to eq false | ||
end | ||
end | ||
end |
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.
Not sure there's better logic here for updating only one intake, but since we don't have a unique validation constraint on the intake, there could be multiple intakes with the same email. I kept the pattern of creating multiple incoming_emails established in the
MailgunWebhooksController
. Grabbing the last intake is also not a guarantee to grabbing the right one, so I am open to feedback here.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.
I think updating all of them rather than just the last one is absolutely the right call