From: jenkins-bot Date: Tue, 25 Sep 2018 20:24:41 +0000 (+0000) Subject: Merge "Forward X-Search-ID header to search suggest tracking" X-Git-Tag: 1.34.0-rc.0~3988 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=c5d44cc0cfcb8053479f617f4a5c2427178948dd;hp=-c;p=lhc%2Fweb%2Fwiklou.git Merge "Forward X-Search-ID header to search suggest tracking" --- c5d44cc0cfcb8053479f617f4a5c2427178948dd diff --combined resources/src/mediawiki.searchSuggest/searchSuggest.js index d3b64b06c8,f38ec06cf3..044ac3ffb2 --- a/resources/src/mediawiki.searchSuggest/searchSuggest.js +++ b/resources/src/mediawiki.searchSuggest/searchSuggest.js @@@ -2,7 -2,7 +2,7 @@@ /*! * Add search suggestions to the search form. */ -( function ( mw, $ ) { +( function () { var searchNS = $.map( mw.config.get( 'wgFormattedNamespaces' ), function ( nsName, nsID ) { if ( nsID >= 0 && mw.user.options.get( 'searchNs' + nsID ) ) { // Cast string key to number @@@ -22,6 -22,7 +22,7 @@@ } ).done( function ( data, jqXHR ) { response( data[ 1 ], { type: jqXHR.getResponseHeader( 'X-OpenSearch-Type' ), + searchId: jqXHR.getResponseHeader( 'X-Search-ID' ), query: query } ); } ); @@@ -113,6 -114,7 +114,7 @@@ action: 'impression-results', numberOfResults: context.config.suggestions.length, resultSetType: metadata.type || 'unknown', + searchId: metadata.searchId || null, query: metadata.query, inputLocation: getInputLocation( context ) } ); @@@ -320,4 -322,4 +322,4 @@@ .find( '.mw-fallbackSearchButton' ).remove(); } ); -}( mediaWiki, jQuery ) ); +}() ); diff --combined resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js index e821ce8fdc,0d0fa86eaf..18cd68acb0 --- a/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js @@@ -4,7 -4,7 +4,7 @@@ * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ -( function ( $, mw ) { +( function () { /** * Creates a mw.widgets.SearchInputWidget object. @@@ -156,6 -156,7 +156,7 @@@ // tracking purposes promise.done( function ( data, jqXHR ) { self.requestType = jqXHR.getResponseHeader( 'X-OpenSearch-Type' ); + self.searchId = jqXHR.getResponseHeader( 'X-Search-ID' ); } ); return promise; @@@ -173,10 -174,12 +174,12 @@@ data: response || {}, metadata: { type: this.requestType || 'unknown', + searchId: this.searchId || null, query: this.getQueryValue() } }; this.requestType = undefined; + this.searchId = undefined; return resp; }; @@@ -215,6 -218,7 +218,7 @@@ action: 'impression-results', numberOfResults: items.length, resultSetType: data.metadata.type, + searchId: data.metadata.searchId, query: data.metadata.query, inputLocation: this.dataLocation || 'header' } ); @@@ -248,4 -252,4 +252,4 @@@ return items; }; -}( jQuery, mediaWiki ) ); +}() );