@@ -250,7 +250,14 @@ var UniversalBot = (function (_super) {
250
250
this . _onDisambiguateRoute = handler ;
251
251
} ;
252
252
UniversalBot . prototype . loadSession = function ( address , done ) {
253
+ this . loadSessionWithOptionalDispatch ( address , false , done ) ;
254
+ } ;
255
+ UniversalBot . prototype . loadSessionWithoutDispatching = function ( address , done ) {
256
+ this . loadSessionWithOptionalDispatch ( address , false , done ) ;
257
+ } ;
258
+ UniversalBot . prototype . loadSessionWithOptionalDispatch = function ( address , shouldDispatch , done ) {
253
259
var _this = this ;
260
+ var newStack = false ;
254
261
this . lookupUser ( address , function ( user ) {
255
262
var msg = {
256
263
type : consts . messageType ,
@@ -271,7 +278,7 @@ var UniversalBot = (function (_super) {
271
278
persistUserData : _this . settings . persistUserData ,
272
279
persistConversationData : _this . settings . persistConversationData
273
280
} ;
274
- _this . createSession ( storageCtx , msg , _this . settings . defaultDialogId || '/' , _this . settings . defaultDialogArgs , done ) ;
281
+ _this . createSession ( storageCtx , msg , _this . settings . defaultDialogId || '/' , _this . settings . defaultDialogArgs , done , newStack , shouldDispatch ) ;
275
282
} , _this . errorLogger ( done ) ) ;
276
283
} , this . errorLogger ( done ) ) ;
277
284
} ;
@@ -288,9 +295,10 @@ var UniversalBot = (function (_super) {
288
295
}
289
296
} , newStack ) ;
290
297
} ;
291
- UniversalBot . prototype . createSession = function ( storageCtx , message , dialogId , dialogArgs , done , newStack ) {
298
+ UniversalBot . prototype . createSession = function ( storageCtx , message , dialogId , dialogArgs , done , newStack , shouldDispatch ) {
292
299
var _this = this ;
293
300
if ( newStack === void 0 ) { newStack = false ; }
301
+ if ( shouldDispatch === void 0 ) { shouldDispatch = true ; }
294
302
var loadedData ;
295
303
this . getStorageData ( storageCtx , function ( data ) {
296
304
if ( ! _this . localizer ) {
@@ -340,7 +348,12 @@ var UniversalBot = (function (_super) {
340
348
delete session . privateConversationData [ consts . Data . SessionState ] ;
341
349
}
342
350
loadedData = data ;
343
- session . dispatch ( sessionState , message , function ( ) { return done ( null , session ) ; } ) ;
351
+ if ( shouldDispatch ) {
352
+ session . dispatch ( sessionState , message , function ( ) { return done ( null , session ) ; } ) ;
353
+ }
354
+ else {
355
+ done ( null , session ) ;
356
+ }
344
357
} , done ) ;
345
358
} ;
346
359
UniversalBot . prototype . routeMessage = function ( session , done ) {
0 commit comments