fix: invitation accept-link rendering as null in invite/resend/update emails - #2056
Open
samark231 wants to merge 1 commit into
Open
fix: invitation accept-link rendering as null in invite/resend/update emails#2056samark231 wants to merge 1 commit into
samark231 wants to merge 1 commit into
Conversation
Contributor
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 26 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Fixes the "Accept Invitation" button in team/role invitation emails resolving to a broken
nulllink (DNS NXDOMAIN). When a user is invited to a team with a role (e.g. COUNSELLOR), the email's login URL was computed incorrectly and rendered as the literal stringnull.Root cause: in
InviteUserService.sendInvitationEmail, the null-guard checkedlearnerPortalUrlbut assignedadminPortalUrl. For institutes that have a learner portal URL set but a null admin portal URL (the common case —admin_portal_base_urlis a nullable column and Hibernate bypasses its DB default), the guard passed and overwrote the safe default withnull. Thatnullwas then formatted into the email'shref.A second, independent bug is also fixed: the resend/update invitation emails used a
static @Valuefield (ADMIN_LOGIN_URL), which Spring cannot inject — so it was alwaysnull, producing a permanentnull/loginlink for every resend/update.Backend:
InviteUserService.sendInvitationEmail: guard now checksadminPortalUrl(the field actually used) viaStringUtils.hasText; falls back tohttps://dash.vacademy.iowhen unset.normalizeUrlhelper that prependshttps://to schemeless portal URLs (DB column default and some stored values have no scheme), preventing relative/broken links.InviteUserService.sendReminderEmail: now resolves the institute's admin portal URL (same logic + fallback) and passes it into the reminder template.InviteUserEmailBody: removed the brokenstatic @Value adminPortalClientUrlandADMIN_LOGIN_URLconstant;createReminderEmailnow accepts anadminLoginUrlparameter.Frontend:
Related Issue
N/A
Type of Change
How Has This Been Tested?
https://dash.vacademy.iofor an institute with no admin portal URL) instead ofnull.null/login.Checklist