public void setEmailAddress(String emailAddress, ApplicationUser loggedInUser, EmailFormatter emailFormatter) { this.emailAddress = emailFormatter.formatEmail(emailAddress, loggedInUser); }
public String getDisplayEmail(String email) { return emailFormatter.formatEmail(email, getLoggedInUser()); }
private String[] assembleDisplayNameParts(final ApplicationUser user, final ApplicationUser searcher) { final String fullName = user.getDisplayName(); final String name = user.getName(); final String email = emailFormatter.formatEmail(user, searcher); if (email != null) { return new String [] {fullName, "- " + email, " (" + name + ")"}; } else { return new String [] {fullName, " (" + name + ")"}; } } }
public RemoteUser createUser(final User user) { Assertions.notNull("user", user); final RemoteUser remoteUser = new RemoteUser(user); // JRA-19498: set email according to visibility settings remoteUser.setEmail(emailFormatter.formatEmail(user.getEmailAddress(), true)); return remoteUser; }
user.getDisplayName(), user.isActive(), emailFormatter.formatEmail(user.getEmailAddress(), loggedInUser), copyOf(Iterables.transform(groups, new GroupNameToGroupJsonBean(jiraBaseUrls))), getAvatarURLs(user, jiraAvatarSupport),
/** * Creates an AssigneeOption for the given user. This method uses {@code fullNames} as a basis for determining * whether a given user display name is unique in the system. If the display name is not unique then the username * is appended to the display name as a means to disambiguate users with the same display name. * <p/> * If {@code fullNames} is null, then the display name is returned as-is. * <p/> * See JRA-14128. */ private AssigneeOption createAssigneeOption(ApplicationUser user, final ApplicationUser loggedInUser, @Nullable Map<String, Boolean> fullNames) { String displayName = user.getDisplayName(); boolean isUnique = fullNames == null || fullNames.get(displayName); if (!isUnique) { displayName += " (" + user.getName() + ")"; } URI avatarURL = avatarService.getAvatarURL(loggedInUser, user.getName(), Avatar.Size.SMALL); String email = emailFormatter.formatEmail(user.getEmailAddress(), loggedInUser); AssigneeOption option = new AssigneeOption(user.getName(), displayName, email, avatarURL.toString()); option.setLoggedInUser(user.equals(loggedInUser)); return option; }
/** * Returns a new UserBean with all properties set. * * @return a new UserBean */ public UserBean buildMid() { if (user == null) { return buildSimple(); } if (!loggedInUserIsSet) { throw new IllegalStateException("loggedInUser not set"); } if (emailFormatter == null) { throw new IllegalStateException("emailFormatter not set"); } if (timeZone == null) { throw new IllegalStateException("timeZone not set"); } return new UserBean( self != null ? self : createSelfLink(), user.getKey(), user.getUsername(), user.getDisplayName(), user.isActive(), emailFormatter.formatEmail(user.getEmailAddress(), loggedInUser), null, getAvatarURLs(user, jiraAvatarSupport), timeZone, beanFactory.getInstance(user).getLocale(), null ); }