 								.populateAll()
 			.then (items) ->
 				# update all subscribers' roster item
-				Promise
-					.all _.map items, (roster) ->
-						roster.sent values
+				Promise.map items, (roster) ->
+					roster.sent values
 			.then ->
 				cb()
 			.catch cb

 # @description :: TODO: You might write a short summary of how this model works and what it represents here.
 # @docs        :: http://sailsjs.org/#!documentation/models
_ = require 'lodash'
Promise = require 'promise'
gfs = require('skipper-gridfs')(sails.config.file.opts)
path = require 'path'


		cb()

	afterPublishCreate: (values, req) ->
		# create roster items for recipients if not yet defined
		sails.services.roster
			.recipient values.from, values.to
			.catch sails.log.error
		# send push notification to all subscribers excluding sender
		sails.models.roster
			.findOne jid: values.to
			.populateAll()
			.then (items) ->
				Promise.map items, (item) ->
					if item.createdBy.jid != values.from
						sails.services.gcm
							.push req.user.token, item, values
