Skip to content

Commit

Permalink
fix(NotificationUtils): Edit special char if using fallback email.
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Nov 26, 2024
1 parent be2f456 commit c1aa232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,9 @@ public static String replaceUserNameInFromEmail(String fromEmail, OtpUser otpUse

int firstBracketIndex = fromEmail.indexOf('<');
int lastBracketIndex = fromEmail.indexOf('>');
String displayedName = Strings.isBlank(otpUser.name) ? otpUser.email : otpUser.name;
// HACK: If falling back on email, replace the "@" sign so that the user's email does not override the
// application email in brackets.
String displayedName = Strings.isBlank(otpUser.name) ? otpUser.email.replace("@", " at ") : otpUser.name;
return String.format("%s %s", displayedName, fromEmail.substring(firstBracketIndex, lastBracketIndex + 1));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private static Stream<Arguments> createCanReplaceUserNameInFromEmailCases() {
String emailAlias = "<[email protected]>";

return Stream.of(
Arguments.of(emailAlias, user1, user1.email),
Arguments.of(null, user1, user1.email),
Arguments.of(emailAlias, user1, "user1 at example.com"),
Arguments.of(null, user1, null),
Arguments.of(emailAlias, user2, user2.name)
);
}
Expand Down

0 comments on commit c1aa232

Please sign in to comment.