Package com.atlassian.jira.util
Interface EmailFormatter
- All Known Implementing Classes:
EmailFormatterImpl
@PublicApi
public interface EmailFormatter
Returned email address appropriately masked/hidden for the current user.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanemailVisible(ApplicationUser currentUser) Returns whether or not email addresses are visible to this user, as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.formatEmail(ApplicationUser user, ApplicationUser currentUser) Formatsuser's email address for the purpose of displaying it tocurrentUser, as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.formatEmail(String email, boolean isCurrentUserLoggedIn) Formats an email address for the purpose of displaying it to a user as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.formatEmail(String email, ApplicationUser currentUser) Formats an email address for the purpose of displaying it to a user as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.formatEmailAsLink(String email, ApplicationUser currentUser) Returns email address as HTML links, if appropriate.
-
Method Details
-
emailVisible
Returns whether or not email addresses are visible to this user, as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.- Parameters:
currentUser- the user to which email addresses will be shown, ornullif no user is logged in (browsing anonymously)- Returns:
trueif email addresses should be visible (even if they will be masked);falseotherwise- Since:
- v4.3 (moved to API in v6.0)
-
formatEmail
Formatsuser's email address for the purpose of displaying it tocurrentUser, as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.This convenience method is exactly equivalent to
formatEmail(user.getEmailAddress(), currentUser != null), except that it isnull-safe.- Parameters:
user- owner of the email address to format and display (nullis permitted)currentUser- the user to which email addresses will be shown, ornullif no user is logged in (browsing anonymously)- Returns:
- the formatted email address;
nullif eitheruserisnullorcurrentUseris not permitted to see email addresses - Since:
- v4.3 (moved to API in v6.0)
-
formatEmail
Formats an email address for the purpose of displaying it to a user as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.Setting Behaviour "show"The email is shown as-is to everyone. "user"The email is shown as-is to users that are logged in, but not shown to anonymous users. "mask"The email is shown to all users with the e-mail address slightly obscured, such that "user@example.com"appears as"user at example dot com", instead- Parameters:
email- The email address to show/mask/hide.isCurrentUserLoggedIn-trueif a user is currently logged in;falseif the user is browsing anonymously- Returns:
- the formatted email address;
nullif eitheremailisnullor the user is not permitted to see email addresses
-
formatEmail
Formats an email address for the purpose of displaying it to a user as determined by theAPKeys.JIRA_OPTION_EMAIL_VISIBLEsetting.This convenience method is exactly equivalent to
formatEmail(email, currentUser != null).- Parameters:
email- The email address to show/mask/hide.currentUser- The user viewing the email address.- Returns:
- the formatted email address;
nullif eitheremailisnullor the user is not permitted to see email addresses - Since:
- v4.3 (moved to API in v6.0)
-
formatEmailAsLink
Returns email address as HTML links, if appropriate. If email addresses are masked, then they are returned as HTML-escaped text, but not as links.- Returns:
<a href="foo@bar.com">foo@bar.com</a>(public),foo at bar.com(masked), or an empty string ("") if eitheremailisnullor the user is not permitted to see email addresses- Since:
- v4.3 (moved to API in v6.0)
-