diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-07-13 17:47:57 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-07-17 15:22:57 -0400 |
commit | 098cbcdc21effeebe7e57fbd912a785e85cbfc5d (patch) | |
tree | fca1c712fe315ed49058de974b21efdaa0dd5b9c /web/react/utils/utils.jsx | |
parent | abcb44089c421872de582584049ca4cc6b268f37 (diff) | |
download | chat-098cbcdc21effeebe7e57fbd912a785e85cbfc5d.tar.gz chat-098cbcdc21effeebe7e57fbd912a785e85cbfc5d.tar.bz2 chat-098cbcdc21effeebe7e57fbd912a785e85cbfc5d.zip |
Unify all locations where we determine a user's display named based off of their nickname/username into a helper function
Diffstat (limited to 'web/react/utils/utils.jsx')
-rw-r--r-- | web/react/utils/utils.jsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 7186251e7..5a1a7ee73 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -796,7 +796,6 @@ module.exports.getHomeLink = function() { return window.location.protocol + "//" + parts.join("."); } - module.exports.changeColor =function(col, amt) { var usePound = false; @@ -824,5 +823,12 @@ module.exports.changeColor =function(col, amt) { else if (g < 0) g = 0; return (usePound?"#":"") + String("000000" + (g | (b << 8) | (r << 16)).toString(16)).slice(-6); +}; +module.exports.getDisplayName = function(user) { + if (user.nickname && user.nickname.trim().length > 0) { + return user.nickname; + } else { + return user.username; + } }; |