Fire window-open-from-tool event for username completion from toolbar

The automatic event from core didn't catch this, because it's not an action
method called "open".

Bug: T255638
Change-Id: Ifa456e850a8edb374df098e21b46bb872416ae55
This commit is contained in:
David Lynch 2020-06-23 10:23:13 -05:00
parent a00bc8411a
commit 02fafccd23

View file

@ -48,6 +48,13 @@ MWUsernameCompletionAction.static.methods.push( 'insertAndOpen' );
/* Methods */
MWUsernameCompletionAction.prototype.insertAndOpen = function () {
// This is opening a window in a slightly weird way, so the normal logging
// doesn't catch it. This assumes that the only way to get here is from
// the tool. If we add other paths, we'd need to change the logging.
ve.track(
'activity.' + this.constructor.static.name,
{ action: 'window-open-from-tool' }
);
this.surface.getModel().getFragment().insertContent( '@' ).collapseToEnd().select();
return this.open();
};