Only count clicks on the copy link once

Bug: T256130
Change-Id: I6eb896ac19502ffcbb3b45b8a2b51ed352593237
这个提交包含在:
WMDE-Fisch 2020-06-25 20:57:29 +02:00 提交者 Thiemo Kreuz (WMDE)
父节点 504ecf7620
当前提交 4c99ef7510
共有 2 个文件被更改,包括 7 次插入2 次删除

查看文件

@ -38,6 +38,6 @@
* **{PREFIX}.conflict.resolved.byUserEdits.under11.{AGGREGATION}** - Number of edit conflicts resolved by users with 0-10 edits
* **{PREFIX}.copy.jsclick.{AGGREGATION}** - Total number of clicks of the link to copy the originally submitted text in-place
* **{PREFIX}.copy.jsclick.{AGGREGATION}** - Total number of clicks of the link to copy the originally submitted text in-place ( multiple clicks from the same conflict will only be counted once )
* **{PREFIX}.copy.special.load.{AGGREGATION}** - Total number of loads of the special page to show the originally submitted text
* **{PREFIX}.copy.special.retrieved.{AGGREGATION}** - Total number of successfully retrieved texts from the cache on the special page to show the originally submitted text

查看文件

@ -429,6 +429,7 @@ function initSwapHandling() {
*/
function initSourceCopy() {
var $copyLink = $( '.mw-twocolconflict-copy-link a' ),
wasClicked = false,
$confirmPopup, popupTimeout;
if ( !$copyLink.length ) {
return;
@ -451,7 +452,11 @@ function initSourceCopy() {
$( '.mw-twocolconflict-your-text' ).select();
document.execCommand( 'copy' );
mw.track( 'counter.MediaWiki.TwoColConflict.copy.jsclick' );
if ( !wasClicked ) {
// only count once if the user clicks several times from the same screen
mw.track( 'counter.MediaWiki.TwoColConflict.copy.jsclick' );
wasClicked = true;
}
$confirmPopup.toggle( true );
popupTimeout = setTimeout( function () {