Track events for the new comment notice

Bug: T301582
Change-Id: I40355502a59a7f31e465e52859b303680c1e109f
This commit is contained in:
David Lynch 2022-11-16 11:28:53 -06:00
parent 46d766f30d
commit 84620569dd

View file

@ -943,7 +943,7 @@ ReplyWidget.prototype.updateNewCommentsWarning = function ( comments ) {
this.newCommentsClose
]
} );
this.newCommentsShow.connect( this, { click: [ 'emit', 'reloadPage' ] } );
this.newCommentsShow.connect( this, { click: 'onNewCommentsShowClick' } );
this.newCommentsClose.connect( this, { click: 'onNewCommentsCloseClick' } );
this.$bodyWrapper.append( this.newCommentsWarning.$element );
}
@ -956,9 +956,24 @@ ReplyWidget.prototype.updateNewCommentsWarning = function ( comments ) {
setTimeout( function () {
widget.newCommentsWarning.$element.addClass( 'ext-discussiontools-ui-replyWidget-newComments-open' );
} );
mw.track( 'dt.schemaVisualEditorFeatureUse', {
feature: 'notificationNewComments',
action: 'show'
} );
}
};
/**
* Handle click events on the new comments show button
*/
ReplyWidget.prototype.onNewCommentsShowClick = function () {
this.emit( 'reloadPage' );
mw.track( 'dt.schemaVisualEditorFeatureUse', {
feature: 'notificationNewComments',
action: 'page-update'
} );
};
/**
* Handle click events on the new comments close button
*/
@ -967,6 +982,10 @@ ReplyWidget.prototype.onNewCommentsCloseClick = function () {
// Hide the warning for the rest of the lifetime of the widget
this.hideNewCommentsWarning = true;
this.focus();
mw.track( 'dt.schemaVisualEditorFeatureUse', {
feature: 'notificationNewComments',
action: 'close'
} );
};
/**