summaryrefslogtreecommitdiffstats
path: root/web/react/components/mention_list.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-06-29 15:20:49 -0400
committerJoramWilander <jwawilander@gmail.com>2015-06-29 15:20:49 -0400
commit2d3ef0b0510e4c0be49cb6025e312fcb932789fd (patch)
tree0d639af3121043c69f6178bde3a50cf93c942140 /web/react/components/mention_list.jsx
parent7b7e73fb9290a8084989a4219681c636670e7555 (diff)
downloadchat-2d3ef0b0510e4c0be49cb6025e312fcb932789fd.tar.gz
chat-2d3ef0b0510e4c0be49cb6025e312fcb932789fd.tar.bz2
chat-2d3ef0b0510e4c0be49cb6025e312fcb932789fd.zip
@all and @channel now auto-complete
Diffstat (limited to 'web/react/components/mention_list.jsx')
-rw-r--r--web/react/components/mention_list.jsx15
1 files changed, 14 insertions, 1 deletions
diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx
index 8b7e25b04..eb21e0efe 100644
--- a/web/react/components/mention_list.jsx
+++ b/web/react/components/mention_list.jsx
@@ -74,6 +74,18 @@ module.exports = React.createClass({
users.push(profiles[id]);
}
+ var all = {};
+ all.username = "all";
+ all.full_name = "";
+ all.secondary_text = "Notifies everyone in the team";
+ users.push(all);
+
+ var channel = {};
+ channel.username = "channel";
+ channel.full_name = "";
+ channel.secondary_text = "Notifies everyone in the channel";
+ users.push(channel);
+
users.sort(function(a,b) {
if (a.username < b.username) return -1;
if (a.username > b.username) return 1;
@@ -91,6 +103,7 @@ module.exports = React.createClass({
var splitName = users[i].full_name.split(' ');
firstName = splitName[0].toLowerCase();
lastName = splitName.length > 1 ? splitName[splitName.length-1].toLowerCase() : "";
+ users[i].secondary_text = users[i].full_name;
}
if (firstName.lastIndexOf(mentionText,0) === 0
@@ -99,7 +112,7 @@ module.exports = React.createClass({
<Mention
ref={'mention' + index}
username={users[i].username}
- name={users[i].full_name}
+ secondary_text={users[i].secondary_text}
id={users[i].id}
handleClick={this.handleClick} />
);