@@ -227,6 +227,12 @@ Dialog.prototype.renderMessages = function (dialogId) {
227227 } . bind ( self ) ) ;
228228
229229 messageModule . init ( ) ;
230+
231+ self . quitLink . addEventListener ( 'click' , function ( e ) {
232+ e . preventDefault ( ) ;
233+ if ( dialog . type === CONSTANTS . DIALOG_TYPES . PUBLICCHAT ) return ;
234+ self . quitFromTheDialog ( this . dataset . dialog ) ;
235+ } ) ;
230236 } else {
231237 if ( self . prevDialogId ) {
232238 messageModule . sendStopTypingStatus ( self . prevDialogId ) ;
@@ -246,9 +252,11 @@ Dialog.prototype.renderMessages = function (dialogId) {
246252 }
247253 }
248254
255+ self . editLink . href = '#!/dialog/' + self . dialogId + '/edit' ;
256+ self . quitLink . dataset . dialog = dialogId ;
257+
249258 if ( dialog . type === CONSTANTS . DIALOG_TYPES . GROUPCHAT ) {
250259 self . editLink . classList . remove ( 'hidden' ) ;
251- self . editLink . href = '#!/dialog/' + self . dialogId + '/edit' ;
252260 } else {
253261 self . editLink . classList . add ( 'hidden' ) ;
254262 }
@@ -262,12 +270,6 @@ Dialog.prototype.renderMessages = function (dialogId) {
262270 helpers . clearView ( self . messagesContainer ) ;
263271 helpers . clearView ( self . attachmentsPreviewContainer ) ;
264272 document . forms . send_message . attach_file . value = null ;
265-
266- self . quitLink . onclick = function ( e ) {
267- e . preventDefault ( ) ;
268- if ( dialog . type === CONSTANTS . DIALOG_TYPES . PUBLICCHAT ) return ;
269- self . quitFromTheDialog ( dialogId ) ;
270- } ;
271273 }
272274
273275 messageModule . setLoadMoreMessagesListener ( ) ;
@@ -484,7 +486,7 @@ Dialog.prototype.updateDialog = function (updates) {
484486
485487 self . _cache [ dialogId ] . users = self . _cache [ dialogId ] . users . concat ( newUsers ) ;
486488
487- updatedMsg . body = app . user . name + ' adds ' + usernames . join ( ',' ) + ' to the conversation.' ;
489+ updatedMsg . body = app . user . name + ' adds ' + usernames . join ( ', ' ) + ' to the conversation.' ;
488490 updatedMsg . extension . occupants_ids_added = newUsers . join ( ',' ) ;
489491 } else {
490492 router . navigate ( '/dialog/' + dialogId ) ;
@@ -536,7 +538,7 @@ Dialog.prototype.updateDialog = function (updates) {
536538
537539 _ . each ( users , function ( user ) {
538540 QB . chat . sendSystemMessage ( + user , msg ) ;
539- } )
541+ } ) ;
540542 }
541543} ;
542544
0 commit comments