 generateFakeIdentifier = require 'app/util/generateFakeIdentifier'
 messageHelpers         = require '../helpers/message'
 realtimeActionCreators = require './realtime/actioncreators'
+getGroup = require 'app/util/getGroup'
 
 dispatch = (args...) -> kd.singletons.reactor.dispatch args...
 

    kd.singletons.reactor.batch ->
      messages.forEach (message) ->
        dispatchLoadMessageSuccess channelId, message


###*

 * @param {string} channelId
###
loadMessages = (channelId, options = {}) ->

  # if given channel is group channel, special case it for fetching activities
  # with comments.
  if getGroup().socialApiChannelId is channelId
    return loadPublicChannelMessages channelId, options

  options.limit ?= 25
  { socialapi } = kd.singletons
