-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11838 from 18F/stages/rc-2025-02-04
Deploy RC 449 to Production
- Loading branch information
Showing
97 changed files
with
1,989 additions
and
1,068 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
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
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
2 changes: 1 addition & 1 deletion
2
app/services/create_new_device_alert.rb → app/jobs/create_new_device_alert_job.rb
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
52 changes: 52 additions & 0 deletions
52
app/jobs/grant_account_reset_requests_and_send_emails_job.rb
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# frozen_string_literal: true | ||
|
||
class GrantAccountResetRequestsAndSendEmailsJob < ApplicationJob | ||
queue_as :long_running | ||
|
||
def perform(now) | ||
notifications_sent = 0 | ||
AccountResetRequest.where( | ||
sql_query_for_users_eligible_to_delete_their_accounts, | ||
tvalue: now - IdentityConfig.store.account_reset_wait_period_days.days, | ||
).order('requested_at ASC').each do |arr| | ||
notifications_sent += 1 if grant_request_and_send_email(arr) | ||
end | ||
|
||
analytics.account_reset_notifications(count: notifications_sent) | ||
|
||
notifications_sent | ||
end | ||
|
||
private | ||
|
||
def analytics | ||
@analytics ||= Analytics.new( | ||
user: AnonymousUser.new, | ||
request: nil, | ||
sp: nil, | ||
session: {}, | ||
) | ||
end | ||
|
||
def sql_query_for_users_eligible_to_delete_their_accounts | ||
<<~SQL | ||
cancelled_at IS NULL AND | ||
granted_at IS NULL AND | ||
requested_at < :tvalue AND | ||
request_token IS NOT NULL AND | ||
granted_token IS NULL | ||
SQL | ||
end | ||
|
||
def grant_request_and_send_email(arr) | ||
user = arr.user | ||
return false unless AccountReset::GrantRequest.new(user).call | ||
|
||
arr = arr.reload | ||
user.confirmed_email_addresses.each do |email_address| | ||
UserMailer.with(user: user, email_address: email_address) | ||
.account_reset_granted(arr).deliver_now_or_later | ||
end | ||
true | ||
end | ||
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
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
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
Oops, something went wrong.