public String getAvatarUrl(ApplicationUser user) { if(user != null) { return avatarService.getAvatarURL(getLoggedInUser(), user).toString(); } return null; }
@Override public String doDefault() throws Exception { avatarUrl = avatarService.getAvatarURL(getLoggedInUser(), user, LARGE); return SUCCESS; }
/** * @see AvatarService#getAvatarURL(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.avatar.Avatar.Size) */ public String renderURL(ApplicationUser loggedInUser, ApplicationUser avatarUser, Avatar.Size size) { return avatarService.getAvatarURL(loggedInUser, avatarUser != null ? avatarUser.getName() : null, size).toString(); } }
private String getAvatarURL(final ApplicationUser applicationUser) { return avatarService.getAvatarURL(authenticationContext.getUser(), applicationUser, Avatar.Size.NORMAL).toString(); } }
/** * @return the URL of the default avatar. */ private String getDefaultAvatarURL() { return avatarService.getAvatarURL(authenticationContext.getLoggedInUser(), (ApplicationUser) null, SMALL).toString(); } }
public URI getAvatarUrl(final String username) { return avatarService.getAvatarURL(getLoggedInUser(), username, SMALL); }
public URI getLeadUserAvatarUrl() { return avatarService.getAvatarURL(getLoggedInUser(), getLead(), SMALL); }
public RoleActorBean get(RoleActor actor) { final RoleActorBean bean = RoleActorBean.convert(actor); bean.setAvatarUrl(avatarService.getAvatarURL(loggedInUser, bean.getName(), Avatar.Size.SMALL)); return bean; } });
private UserPickerResultsBean makeUserPickerBean(Collection<ApplicationUser> users, Collection<ApplicationUser> page, String query, Boolean showAvatar) { int total = users.size(); int showing = page.size(); final boolean canShowEmailAddresses = userSearchService.canShowEmailAddresses(getContext()); if (showAvatar == null) { showAvatar = false; } List<UserPickerUser> beans = new ArrayList<UserPickerUser>(page.size()); for (ApplicationUser user : page) { final String html = formatUser(user, query, canShowEmailAddresses); beans.add(new UserPickerUser(user.getName(), ApplicationUsers.getKeyFor(user), user.getDisplayName(), html, showAvatar ? avatarService.getAvatarURL(user, user.getName(), Avatar.Size.SMALL) : null)); } return new UserPickerResultsBean(beans, i18n.getText("jira.ajax.autocomplete.user.more.results", String.valueOf(showing), String.valueOf(total)), total); }
final String userKey = ""; final String displayName = user.getDisplayName(); final URI avatarURI48x48 = avatarService.getAvatarURL(currentUser, user, Avatar.Size.LARGE); final String avatarPath48x48 = avatarURI48x48.toString(); final UserReference userReference = new UserReference(
private void redirectToExternalAvatar(HttpServletResponse response, String ownerId, AvatarManager.ImageSize size) throws IOException { AvatarService avatarService = ComponentAccessor.getAvatarService(); if (!getAvatarManager().hasPermissionToView(getAuthenticationContext().getUser(), getUserUtil().getUserByKey(ownerId))) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } ApplicationUser loggedInUser = getAuthenticationContext().getUser(); URI gravatarURL = avatarService.getAvatarURL(loggedInUser, getUserUtil().getUserByKey(ownerId), size.getSize()); response.sendRedirect(gravatarURL.toString()); }
/** * 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; }
public String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters) { Map velocityParams = getVelocityParams(fieldLayoutItem, action, issue, displayParameters); String reporterName = (String) operationContext.getFieldValuesHolder().get(getId()); velocityParams.put(getId(), reporterName); velocityParams.put("hasPermissionPickUsers", Boolean.valueOf(getPermissionManager().hasPermission(USER_PICKER, getAuthenticationContext().getUser()))); final ApplicationUser reporterUser = userManager.getUser(reporterName); final ApplicationUser loggedInUser = authenticationContext.getUser(); if (reporterUser != null) { final String avatarUrl = avatarService.getAvatarURL(loggedInUser, reporterName, Avatar.Size.SMALL).toString(); velocityParams.put("reporter", reporterUser.getName()); velocityParams.put("reporterDisplayName", reporterUser.getDisplayName()); velocityParams.put("reporterAvatarUrl", avatarUrl); } JiraServiceContext ctx = new JiraServiceContextImpl(loggedInUser); boolean canPerformAjaxSearch = searchService.canPerformAjaxSearch(ctx); if (canPerformAjaxSearch) { velocityParams.put("canPerformAjaxSearch", "true"); velocityParams.put("ajaxLimit", applicationProperties.getDefaultBackedString(APKeys.JIRA_AJAX_AUTOCOMPLETE_LIMIT)); } WebResourceManager webResourceManager = ComponentAccessor.getWebResourceManager(); webResourceManager.requireResource("jira.webresources:autocomplete"); String template = useFrotherControl() ? "reporter-edit-frother.vm" : "reporter-edit.vm"; return renderTemplate(template, velocityParams); }
results.addUser(new UserPickerUser(user.getName(), user.getDisplayName(), html, showAvatar ? avatarService.getAvatarURL(user, user.getName(), Avatar.Size.SMALL) : null)); ++count; } else {
private Contributor createContributor(ApplicationUser applicationUser) { // find a key to look up the mention name with. // we use the HipChat ID if they are already mapped, otherwise we use their email address from JIRA Option<AOHipChatUser> aoHipChatUserOption = hipChatAOUserManager.getByUserKey(new UserKey(applicationUser.getKey())); final String idOrEmailAddress = aoHipChatUserOption.isDefined() ? aoHipChatUserOption.get().getHipChatUserId() : applicationUser.getEmailAddress(); // now ask HipChat for the mention name Option<User> userOption = userOptionCache.get(idOrEmailAddress); final String jiraAvatarUrl = avatarService.getAvatarURL(jiraAuthenticationContext.getUser(), applicationUser).toString(); String mentionName = userOption.isDefined() ? userOption.get().getMentionName() : null; return new Contributor( applicationUser.getKey(), mentionName, applicationUser.getEmailAddress(), applicationUser.getDisplayName(), jiraAvatarUrl ); }
.setLabel(assignee.getDisplayName()) .setUrl(new URL(baseUrl + "/secure/ViewProfile.jspa?name=" + assignee.getName())) .setIcon(avatarService.getAvatarURL(jiraAuthenticationContext.getUser(), assignee).toURL()).build());
String defaultAvatarURL = avatarService.getAvatarURL(loggedInUser, (String) null, Avatar.Size.SMALL).toString(); final AssigneeOption unassignedAssignee = new AssigneeOption("", i18n.getText("common.concepts.unassigned"), "", defaultAvatarURL); if (isUnassignedIssuesEnabled())
final String avatarURL = avatarService.getAvatarURL(jiraAuthenticationContext.getUser(), user, avatarSize).toString();