summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorAsaad Mahmood <Unknowngi@live.com>2015-07-17 23:10:54 +0500
committerAsaad Mahmood <Unknowngi@live.com>2015-07-17 23:10:54 +0500
commit288bfbbd56d4c931bd0792a24ac96614f3eeb518 (patch)
tree9013abb2007504d3ee45b955939eec921df1f0b6 /web
parent764bd97bc72ac335ce42b5c4e19931b6a72b803b (diff)
parentede7d376f269d7b82904fdad79accc7684484ea6 (diff)
downloadchat-288bfbbd56d4c931bd0792a24ac96614f3eeb518.tar.gz
chat-288bfbbd56d4c931bd0792a24ac96614f3eeb518.tar.bz2
chat-288bfbbd56d4c931bd0792a24ac96614f3eeb518.zip
Merge branch 'master' of https://github.com/mattermost/platform into mm-1426
Diffstat (limited to 'web')
-rw-r--r--web/react/utils/utils.jsx24
1 files changed, 13 insertions, 11 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 530166f04..f8a7d6450 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -728,20 +728,22 @@ module.exports.isComment = function(post) {
}
module.exports.getDirectTeammate = function(channel_id) {
- var userIds = ChannelStore.get(channel_id).name.split('__');
+ var userIds = ChannelStore.get(channel_id).name.split('__');
+ var curUserId = UserStore.getCurrentId();
+ var teammate = {};
- if(userIds.length != 2) {
- return;
- }
-
- var curUser = UserStore.getCurrentId();
+ if(userIds.length != 2 || userIds.indexOf(curUserId) === -1) {
+ return teammate;
+ }
- for(var idx in userIds) {
- if(userIds[idx] === curUser)
- delete userIds[idx];
- }
+ for (var idx in userIds) {
+ if(userIds[idx] !== curUserId) {
+ teammate = UserStore.getProfile(userIds[idx]);
+ break;
+ }
+ }
- return UserStore.getProfile(userIds[0])
+ return teammate;
}
Image.prototype.load = function(url, progressCallback) {