Unify all locations where we determine a user's display named based off of their nickname/username into a helper function

This commit is contained in:
hmhealey
2015-07-13 17:47:57 -04:00
parent abcb44089c
commit 098cbcdc21
6 changed files with 34 additions and 12 deletions

View File

@@ -85,8 +85,8 @@ var MemberListTeamItem = React.createClass({
return (
<div className="row member-div">
<img className="post-profile-img pull-left" src={"/api/v1/users/" + user.id + "/image?time=" + timestamp} height="36" width="36" />
<span className="member-name">{user.nickname.trim() ? user.nickname : user.username}</span>
<span className="member-email">{user.nickname.trim() ? user.username : email}</span>
<span className="member-name">{utils.getDisplayName(user)}</span>
<span className="member-email">{email}</span>
<div className="dropdown member-drop">
<a href="#" className="dropdown-toggle theme" type="button" id="channel_header_dropdown" data-toggle="dropdown" aria-expanded="true">
<span>{currentRoles} </span>

View File

@@ -131,7 +131,7 @@ function getStateFromStores() {
var channel = ChannelStore.getByName(channelName);
if (channel != null) {
channel.display_name = teammate.nickname.trim() != "" ? teammate.nickname : teammate.username;
channel.display_name = utils.getDisplayName(teammate);
channel.teammate_username = teammate.username;
channel.status = UserStore.getStatus(teammate.id);
@@ -150,7 +150,7 @@ function getStateFromStores() {
var tempChannel = {};
tempChannel.fake = true;
tempChannel.name = channelName;
tempChannel.display_name = teammate.nickname.trim() != "" ? teammate.nickname : teammate.username;
tempChannel.display_name = utils.getDisplayName(teammate);
tempChannel.status = UserStore.getStatus(teammate.id);
tempChannel.last_post_at = 0;
readDirectChannels.push(tempChannel);