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.
Этот коммит содержится в:
Yi EungJun
2016-09-20 06:41:19 +09:00
коммит произвёл Harrison Healey
родитель 80b2ce9c3f
Коммит bb69e98631
3 изменённых файлов: 32 добавлений и 9 удалений

Просмотреть файл

@@ -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(