diff options
author | Yi EungJun <semtlenori@gmail.com> | 2016-09-20 06:41:19 +0900 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-09-19 17:41:19 -0400 |
commit | bb69e98631b2541954b6ae465b8ba5f788b9dc49 (patch) | |
tree | 125fac51e896af3b254825a029653d86395f9d2b /webapp/components/suggestion/at_mention_provider.jsx | |
parent | 80b2ce9c3f88f96a1972232607544d347f54fff7 (diff) | |
download | chat-bb69e98631b2541954b6ae465b8ba5f788b9dc49.tar.gz chat-bb69e98631b2541954b6ae465b8ba5f788b9dc49.tar.bz2 chat-bb69e98631b2541954b6ae465b8ba5f788b9dc49.zip |
PLT-4182 Fix incorrect listing for at-mention in comment (#4031)
* Add missing eol
* PLT-4182 Fix incorrect listing for at-mention in comment
Suggestion box for at-mention listed users for the center channel even
if the current textbox is for reply for a post which belongs to a
different channel.
Diffstat (limited to 'webapp/components/suggestion/at_mention_provider.jsx')
-rw-r--r-- | webapp/components/suggestion/at_mention_provider.jsx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/webapp/components/suggestion/at_mention_provider.jsx b/webapp/components/suggestion/at_mention_provider.jsx index 248e459b5..9998e6357 100644 --- a/webapp/components/suggestion/at_mention_provider.jsx +++ b/webapp/components/suggestion/at_mention_provider.jsx @@ -126,6 +126,10 @@ function filterUsersByPrefix(users, prefix, limit, type) { } export default class AtMentionProvider { + constructor(channelId) { + this.channelId = channelId; + } + handlePretextChanged(suggestionId, pretext) { const captured = (/@([a-z0-9\-\._]*)$/i).exec(pretext.toLowerCase()); if (captured) { @@ -134,15 +138,17 @@ export default class AtMentionProvider { // Group users into members and nonmembers of the channel. const users = UserStore.getActiveOnlyProfiles(true); const channelMembers = {}; - const extra = ChannelStore.getCurrentExtraInfo(); - for (let i = 0; i < extra.members.length; i++) { - const id = extra.members[i].id; - if (users[id]) { - channelMembers[id] = users[id]; - Reflect.deleteProperty(users, id); + const channelNonmembers = users; + if (this.channelId != null) { + const extraInfo = ChannelStore.getExtraInfo(this.channelId); + for (let i = 0; i < extraInfo.members.length; i++) { + const id = extraInfo.members[i].id; + if (users[id]) { + channelMembers[id] = users[id]; + Reflect.deleteProperty(channelNonmembers, id); + } } } - const channelNonmembers = users; // Filter users by prefix. const filteredMembers = filterUsersByPrefix( |