message: Fix issue with startPrivateConversationWithPersonId
diff: @@ -331,8 +331,12 @@ function Sparkbot(configuration) {
  convo.on('sent', function(sent_message) {
  // update this convo so that future messages will match
  // since the source message did not have this info in it.
  - convo.source_message.user = message.user;
  + convo.source_message.user = message_options.toPersonEmail;
  convo.source_message.channel = sent_message.roomId;
  +
  + convo.context.user = convo.source_message.user;
  + convo.context.channel = convo.source_message.channel;
  +
  });
  cb(null, convo);
  });
  @@ -344,18 +348,10 @@ function Sparkbot(configuration) {
  */
  bot.startPrivateConversationWithPersonId = function(personId, cb) {
  - var message_options = {};
  -
  - message_options.toPersonId = personId;
  -
  - botkit.startTask(bot, message_options, function(task, convo) {
  - convo.on('sent', function(sent_message) {
  - // update this convo so that future messages will match
  - // since the source message did not have this info in it.
  - convo.source_message.user = message.user;
  - convo.source_message.channel = sent_message.roomId;
  - });
  - cb(null, convo);
  + controller.api.people.get(personId).then(function(identity) {
  + bot.startPrivateConversation({user: identity.emails[0]}, cb);
  + }).catch(function(err) {
  + cb(err);
  });
  };
  