diff options
Diffstat (limited to 'webapp/stores')
-rw-r--r-- | webapp/stores/channel_store.jsx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/webapp/stores/channel_store.jsx b/webapp/stores/channel_store.jsx index 0f2ef9dc0..f1cd0bf82 100644 --- a/webapp/stores/channel_store.jsx +++ b/webapp/stores/channel_store.jsx @@ -47,6 +47,7 @@ class ChannelStoreClass extends EventEmitter { this.setUnreadCounts = this.setUnreadCounts.bind(this); this.getUnreadCount = this.getUnreadCount.bind(this); this.getUnreadCounts = this.getUnreadCounts.bind(this); + this.getChannelNamesMap = this.getChannelNamesMap.bind(this); this.currentId = null; this.postMode = this.POST_MODE_CHANNEL; @@ -358,6 +359,28 @@ class ChannelStoreClass extends EventEmitter { this.channels.splice(element, 1); } } + + getChannelNamesMap() { + var channelNamesMap = {}; + + var channels = this.getChannels(); + for (var key in channels) { + if (channels.hasOwnProperty(key)) { + var channel = channels[key]; + channelNamesMap[channel.name] = channel; + } + } + + var moreChannels = this.getMoreChannels(); + for (var moreKey in moreChannels) { + if (moreChannels.hasOwnProperty(moreKey)) { + var moreChannel = moreChannels[moreKey]; + channelNamesMap[moreChannel.name] = moreChannel; + } + } + + return channelNamesMap; + } } var ChannelStore = new ChannelStoreClass(); |