Summary of this gist: after Michelle and I chatted about https://runway.powerhrg.com/backlog_items/FINC-3481?from=active_sprint, I asked a chat bot to summarize other places in nitro-web that might have the same behavior.
Many notifiers throughout the codebase are using relative paths (_path helpers or hardcoded paths) instead of fully qualified URLs when sending notifications via NotificationCenter.notify() or ConnectClient.message_user(). This causes issues when the notifications are sent through Connect messages, as the links don't include the domain.
-
components/human_resources/app/commands/human_resources/compensation_plan_change_notifier.rb:35-36- Hardcoded
/human_resources/compensation_acknowledgement_acceptances/...
- Hardcoded
-
- Uses
edit_compensation_change_request_path
- Uses
-
- Hardcoded
/human_resources/compensation_change_requests/.../edit
- Hardcoded
-
components/human_resources/lib/human_resources/career_change_request_api.rb:449-451- Method misleadingly named
compensation_change_urlbut returns hardcoded path
- Method misleadingly named
-
- Hardcoded path
components/travel/app/commands/travel/commands/notifier.rb:71-73- Uses
management_review_request_path
- Uses
components/attendance/app/commands/attendance/commands/schedule_notifier.rb:44-46- Uses
new_clock_in_out_path
- Uses
components/leave/lib/leave/leave_request_notification.rb:88- Hardcoded
/leave/leave_request_workspace/...
- Hardcoded
components/nitro_component_transition/lib/nitro_component_transition/change_request_notification.rb:70- Uses
request_path(parameter passed to struct)
- Uses
-
components/recruiting/lib/recruiting/interview_notification_api.rb:18- Hardcoded
/recruiting/calendar_interviews/...
- Hardcoded
-
components/recruiting/lib/recruiting/hiring_requisition_request_notifications_api.rb:157- Hardcoded
/recruiting/hiring_requisition_requests/...
- Hardcoded
components/nitro_survey/lib/nitro_survey/survey_notification.rb:46- Uses
request_path(parameter passed to struct)
- Uses
components/compensation/app/commands/compensation/commands/result_compensation_proposal.rb:169-171- Method misleadingly named
proposal_urlbut usesedit_proposal_path
- Method misleadingly named
-
components/reimbursements/app/commands/reimbursements/commands/notifier.rb:11- Uses
manager_show_request_urlhelper
- Uses
-
components/core_models/app/models/pto_request.rb:261-264- Uses
NitroConfig.get!("nitro/base_url") + path
- Uses
def url_slug
base_url = NitroConfig.get!("nitro/base_url")
"#{base_url}/user_requests/#{id}"
enddef notification_url
Reimbursements::Engine.routes.url_helpers.manager_show_request_url(request)
end
Since this is happening in multiple places throughout nitro-web and we are dealing with existing
urlrecords that are only validated as strings, I think the right solution is to normalize theurlwithin thenotificationmodel:Something like this:
I haven't tested the above (and there might be edge cases I'm missing here) but I think that would account for the majority of scenarios.
Alternatively we can update the callers to use fully qualified domains.