@@ -227,6 +227,12 @@ Dialog.prototype.renderMessages = function (dialogId) {
227
227
} . bind ( self ) ) ;
228
228
229
229
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
+ } ) ;
230
236
} else {
231
237
if ( self . prevDialogId ) {
232
238
messageModule . sendStopTypingStatus ( self . prevDialogId ) ;
@@ -246,9 +252,11 @@ Dialog.prototype.renderMessages = function (dialogId) {
246
252
}
247
253
}
248
254
255
+ self . editLink . href = '#!/dialog/' + self . dialogId + '/edit' ;
256
+ self . quitLink . dataset . dialog = dialogId ;
257
+
249
258
if ( dialog . type === CONSTANTS . DIALOG_TYPES . GROUPCHAT ) {
250
259
self . editLink . classList . remove ( 'hidden' ) ;
251
- self . editLink . href = '#!/dialog/' + self . dialogId + '/edit' ;
252
260
} else {
253
261
self . editLink . classList . add ( 'hidden' ) ;
254
262
}
@@ -262,12 +270,6 @@ Dialog.prototype.renderMessages = function (dialogId) {
262
270
helpers . clearView ( self . messagesContainer ) ;
263
271
helpers . clearView ( self . attachmentsPreviewContainer ) ;
264
272
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
- } ;
271
273
}
272
274
273
275
messageModule . setLoadMoreMessagesListener ( ) ;
@@ -484,7 +486,7 @@ Dialog.prototype.updateDialog = function (updates) {
484
486
485
487
self . _cache [ dialogId ] . users = self . _cache [ dialogId ] . users . concat ( newUsers ) ;
486
488
487
- updatedMsg . body = app . user . name + ' adds ' + usernames . join ( ',' ) + ' to the conversation.' ;
489
+ updatedMsg . body = app . user . name + ' adds ' + usernames . join ( ', ' ) + ' to the conversation.' ;
488
490
updatedMsg . extension . occupants_ids_added = newUsers . join ( ',' ) ;
489
491
} else {
490
492
router . navigate ( '/dialog/' + dialogId ) ;
@@ -536,7 +538,7 @@ Dialog.prototype.updateDialog = function (updates) {
536
538
537
539
_ . each ( users , function ( user ) {
538
540
QB . chat . sendSystemMessage ( + user , msg ) ;
539
- } )
541
+ } ) ;
540
542
}
541
543
} ;
542
544
0 commit comments