   sidebarPublicChannels
 
   allFollowedChannels
+  showPopularMessagesFlag : ShowPopularMessagesFlagStore
 }
 

              .set 'actorsCount', messageLikers.size
              .set 'isInteracted', messageLikers.contains whoami()._id

    return thread.set 'channel', channel
]

channelByName = (name, types = ['topic', 'group', 'announcement']) ->

  (publics, privates) -> publics.concat privates
]

selectedChannelPopularMessages = [
  channelPopularMessages
  selectedChannelThreadId
  (messages, id) -> messages.get id
]

# Returns the selected thread mapped with selected channel instance.
selectedChannelThread = [
  channelThreads
  selectedChannel
  MessageLikersStore
  selectedChannelPopularMessages
  ShowPopularMessagesFlagStore
  allUsers
  (threads, channel, likers, popularMessages, showPopularMessagesFlag, users) ->
    return null  unless channel
    thread = threads.get channel.get('id')
    thread = thread.set 'channel', channel

    if showPopularMessagesFlag
      popularMessages = popularMessages or immutable.Map()
      thread = thread.set 'messages', popularMessages

    thread = thread.update 'messages', (messages) ->
      messages.map (msg) ->
        msg.update 'body', (body) ->
