Advertisement
Guest User

Untitled

a guest
Apr 17th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var self = this;
  2.             self.redirect = function(isGuest){
  3.                 isGuest = (typeof isGuest !== 'undefined' ? isGuest : false);
  4.                 var url = '';
  5.                 if (isGuest) {
  6.                     url = self.get('controllers.application.configs.site_url')+'/chat?chatRemoteID=0&remoteGuestId='+remoteId+'&topicId=undefined&nocache='+ new Date().getTime();
  7.                 } else {
  8.                     url = self.get('controllers.application.configs.site_url')+'/chat?chatRemoteID='+remoteId+'&topicId=undefined&nocache='+ new Date().getTime();
  9.                 }
  10.  
  11.                 window.open(url,'_blank');
  12.             }
  13.  
  14.             if (consultId){
  15.                 this.store.fetchById('consultation', consultId).then(function(c){
  16.                     var unreadMsgCount = c.get('unreadMsgCount');
  17.                     self.decrementProperty('controllers.application.configs.totalUnreadMsg', unreadMsgCount);
  18.                     c.set('unreadMsgCount', 0);
  19.                     if (c.get('remoteUser.isGuest')){
  20.                         self.redirect(true);
  21.                     } else {
  22.                         self.redirect();
  23.                     }
  24.                 });
  25.             } else {
  26.                 self.redirect();
  27.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement