Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b9e2d24
feat: init refactor and documents page
cliu02 Apr 8, 2026
a9a089a
feat: cleanup
cliu02 Apr 8, 2026
04cc54e
feat: update routing
cliu02 Apr 8, 2026
d6584a7
chore: old token
cliu02 Apr 9, 2026
de09189
test: tests
cliu02 Apr 9, 2026
e96ce0a
chore: more refactors
cliu02 Apr 9, 2026
f114d1a
chore: cleanup
cliu02 Apr 9, 2026
38a1938
chore: cleanup and placeholder
cliu02 Apr 9, 2026
778c99a
chore: cleanup
cliu02 Apr 9, 2026
91c94b7
chore: cleanup
cliu02 Apr 9, 2026
e8d2d29
chore: renaming
cliu02 Apr 9, 2026
6527593
chore: main merge conflict
cliu02 Apr 9, 2026
2637ab7
fix: backwards compatible
cliu02 Apr 9, 2026
a076d5e
feat: update record response
cliu02 Apr 9, 2026
69e6f79
chore: cleanup
cliu02 Apr 9, 2026
7b3c7f4
chore: refactor
cliu02 Apr 9, 2026
4731ffb
fix: old email param
cliu02 Apr 9, 2026
59c91a7
test: update tests
cliu02 Apr 9, 2026
03ecf9f
test: update tests
cliu02 Apr 9, 2026
2100d8a
Merge branch 'main' into DAH-4006-i2i-next-steps
cliu02 Apr 13, 2026
0dce7be
feat: next steps page
cliu02 Apr 15, 2026
32b16be
chore: refactor
cliu02 Apr 15, 2026
bfe2f69
Merge branch 'main' into DAH-4006-i2i-next-steps
cliu02 Apr 15, 2026
27bac01
feat: use scheduling url
cliu02 Apr 15, 2026
7446e9c
chore: refactor and fallbacks
cliu02 Apr 15, 2026
10629cc
Merge branch 'main' into DAH-4006-i2i-next-steps
cliu02 Apr 15, 2026
789a7c0
fix: merge conflict
cliu02 Apr 15, 2026
fb7aa2c
test: add test
cliu02 Apr 15, 2026
8714824
chore: renaming
cliu02 Apr 16, 2026
99eb4a2
Merge branch 'main' into DAH-4006-i2i-next-steps
cliu02 Apr 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 178 additions & 0 deletions app/assets/json/translations/react/en.json
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info Sensitive Data Finding

PII

More Details
Attribute Value
Data Classifier PII/Name
Data Classifier ID BUILTIN-125

Sampled Examples

Key Value
assistance.contact.helpLine.title1 Frc*o
assistance.contact.questionsAboutListings.title1 D****A

Rule ID: BUILTIN-125


To ignore this finding as an exception, reply to this conversation with #wiz_ignore reason

If you'd like to ignore this finding in all future scans, add an exception in the .wiz file (learn more) or create an Ignore Rule (learn more).


To get more details on how to remediate this issue using AI, reply to this conversation with #wiz remediate

Large diffs are not rendered by default.

124 changes: 0 additions & 124 deletions app/controllers/api/v1/invite_to_apply_controller.rb

This file was deleted.

40 changes: 40 additions & 0 deletions app/controllers/api/v1/invite_to_response_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
class Api::V1::InviteToResponseController < ApiController

def record_response
params.expect(record: %i[type deadline appId applicationNumber response action listingId])
type, deadline, application_id, application_number, response, action, listing_id =
params[:record].values_at(:type, :deadline, :appId, :applicationNumber, :response, :action, :listingId)

Comment thread
cliu02 marked this conversation as resolved.
if deadline_has_passed?(deadline)
Rails.logger.info(
'InviteToResponseController#record_response: deadline passed - not recording ' \
"type=#{type}, " \
"listingId=#{listing_id}, " \
"deadline=#{deadline}, " \
"appId=#{application_id}, " \
"applicationNumber=#{application_number}, " \
"response=#{response}, " \
"action=#{action}",
)
else
DahliaBackend::MessageService.send_invite_to_apply_response(
deadline,
application_id,
application_number,
response,
action,
listing_id
)
end
render json: { success: true }, status: :ok
rescue StandardError => e
Rails.logger.error("Submit response error: #{e.message}")
render json: { error: 'Submit response error' }, status: :internal_server_error
end

private

def deadline_has_passed?(deadline)
Time.zone.parse(deadline).to_date < Time.zone.today
end
Comment thread
cliu02 marked this conversation as resolved.
end
Original file line number Diff line number Diff line change
@@ -1,75 +1,88 @@
# Controller for the page shown when applicants respond to invite to apply email
class InviteToApplyPageController < ApplicationController
# Invite to X controller
class InviteToController < ApplicationController
def index
decoded_params = decode_token(params[:t])
if decoded_params.is_a?(String)
redirect_to decoded_params
return
end

# TODO: uncomment when backend token updated
# decoded_params = decode_token(params[:t])
# if decoded_params.is_a?(String)
# redirect_to decoded_params
# return
# end
decoded_params ||= params
@invite_to_apply_props = props(decoded_params)
@invite_to_props = props(decoded_params)
# Get file upload URL for application
if decoded_params['appId'].present?
application = Force::ShortFormService.get(decoded_params['appId'])
@invite_to_props = @invite_to_props.merge(
url: application['uploadURL'],
)
end
if decoded_params['applicationNumber'].present?
application = Force::ShortFormService.get(decoded_params['applicationNumber'])
@invite_to_apply_props = @invite_to_apply_props.merge(
fileUploadUrl: application['uploadURL'],
@invite_to_props = @invite_to_props.merge(
url: application['uploadURL'],
)
end

# TODO: isTestEmail toggle

record_response(decoded_params)
render 'invite_to_apply'
render 'invite_to'
end

def documents
@invite_to_apply_props = props.merge(documentsPath: true)
render 'invite_to_apply'
@invite_to_props = props(params).merge(documentsPath: true)
render 'invite_to'
end

private

# Deprecated I2A pilot - remove references to applicationNumber and response in DAH-4045
def props(decoded_params = params)
url_params = {
type: decoded_params['type'],
deadline: decoded_params['deadline'],
response: decoded_params['response'],
applicationNumber: decoded_params['applicationNumber'],
inviteAction: decoded_params['inviteAction'] || decoded_params['response'],
Comment thread
cliu02 marked this conversation as resolved.
Outdated
appId: decoded_params['appId'] || decoded_params['applicationNumber'],
}

{
assetPaths: static_asset_paths,
urlParams: url_params,
submitPreviewLinkTokenParam: encode_token(url_params.except(:response)),
submitPreviewLinkTokenParam: encode_token(url_params.except(:inviteAction, :response)),
}.compact
end

def record_response(decoded_params)
deadline = decoded_params['deadline']
response = decoded_params['response']
application_number = decoded_params['applicationNumber']
invite_action = decoded_params['inviteAction']
app_id = decoded_params['appId']

if response.blank? || (deadline && deadline_has_passed?(deadline)) || language_change?
if (invite_action.blank? && response.blank?) || (deadline && deadline_has_passed?(deadline)) || language_change?
Rails.logger.info(
'InviteToApplyPageController#record_response: *NOT* recording ' \
'InviteToController#record_response: *NOT* recording ' \
"deadline=#{deadline}, " \
"app_id=#{app_id}, " \
"application_number=#{application_number}, " \
"inviteAction=#{invite_action.inspect}, " \
"response=#{response.inspect}",
)
return
end

Rails.logger.info(
'InviteToApplyPageController#record_response: recording ' \
'InviteToController#record_response: recording ' \
"deadline=#{deadline}, " \
"app_id=#{app_id}, " \
"application_number=#{application_number}, " \
"inviteAction=#{invite_action}, " \
"response=#{response}",
)

DahliaBackend::MessageService.send_invite_to_apply_response(
deadline,
app_id,
application_number,
response,
invite_action,
params['id'], # listing_id
)
end
Expand All @@ -85,9 +98,10 @@ def decode_token(token)
# {
# "exp" => 946598400,
# "data" => {
# "type" => "I2I",
# "deadline" => "1999-12-31",
# "response" => "yes",
# "applicationNumber" => "12345678"
# "inviteAction" => "yes",
# "appId" => "12345678"
# },
# "iat" => 946512000
# },
Expand All @@ -100,13 +114,13 @@ def decode_token(token)
{ algorithm: ENV.fetch('JWT_ALGORITHM', nil), verify_expiration: false },
)
Rails.logger.info(
'InviteToApplyPageController#decode_token: ' \
'InviteToController#decode_token: ' \
"Decoded JWT #{decoded_token}",
)
decoded_token.first['data']
rescue JWT::DecodeError
Rails.logger.info(
'InviteToApplyPageController#decode_token: ' \
'InviteToController#decode_token: ' \
"Invalid JWT in #{request.original_url}",
)
root_url
Expand All @@ -126,8 +140,8 @@ def deadline_has_passed?(deadline)

def language_change?
# return true when current url and referrer url look like:
# '.../listings/a123/invite-to-apply?...'
# '.../es/listings/a123/invite-to-apply?...'
# '.../listings/a123/next-steps?...'
# '.../es/listings/a123/next-steps?...'
request.referrer&.include?(request.path.slice(%r{/listings/.+}))
end

Expand Down
5 changes: 4 additions & 1 deletion app/javascript/__tests__/api/inviteToApplyApiService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ describe("inviteToApplyApiService", () => {
post as jest.Mock
const record = {
listingId: "a0w123",
applicationNumber: "a0o123",
appId: "a0o123",
applicationNumber: "12345",
deadline: "2099-01-01",
action: "submit",
response: "submit",
type: "I2A",
}
await recordResponse(record)
expect(post).toHaveBeenCalled()
Expand Down
Loading
Loading