Petar.petkovic has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383413 )

Change subject: Add option to hide missing pages while searching
......................................................................

Add option to hide missing pages while searching

Bug: T177469
Change-Id: Ie5fdbe6eacde05473101d480a98eb5f2b3c6251d
---
M resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/13/383413/1

diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js 
b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
index db56bd3..8ddef54 100644
--- a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
+++ b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
@@ -22,6 +22,7 @@
         * @cfg {boolean} [showRedirectTargets=true] Show the targets of 
redirects
         * @cfg {boolean} [showImages] Show page images
         * @cfg {boolean} [showDescriptions] Show page descriptions
+        * @cfg {boolean} [showMissing=true] Show missing pages
         * @cfg {boolean} [excludeCurrentPage] Exclude the current page from 
suggestions
         * @cfg {boolean} [validateTitle=true] Whether the input must be a 
valid title (if set to true,
         *  the widget will marks itself red for invalid inputs, including an 
empty query).
@@ -44,6 +45,7 @@
                this.showRedirectTargets = config.showRedirectTargets !== false;
                this.showImages = !!config.showImages;
                this.showDescriptions = !!config.showDescriptions;
+               this.showMissing = config.showMissing !== false;
                this.excludeCurrentPage = !!config.excludeCurrentPage;
                this.validateTitle = config.validateTitle !== undefined ? 
config.validateTitle : true;
                this.cache = config.cache;
@@ -227,6 +229,9 @@
 
                for ( index in data.pages ) {
                        suggestionPage = data.pages[ index ];
+                       if ( !this.showMissing && suggestionPage.missing !== 
undefined ) {
+                               continue;
+                       }
                        // When excludeCurrentPage is set, don't list the 
current page unless the user has type the full title
                        if ( this.excludeCurrentPage && suggestionPage.title 
=== currentPageName && suggestionPage.title !== titleObj.getPrefixedText() ) {
                                continue;

-- 
To view, visit https://gerrit.wikimedia.org/r/383413
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5fdbe6eacde05473101d480a98eb5f2b3c6251d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Petar.petkovic <ppetko...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to