jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/363801 )

Change subject: Checklist: Filter actual checklists from template namespace
......................................................................


Checklist: Filter actual checklists from template namespace

In the checklist panel, only templates are shown that match these
criteria
* only list items in the included text
* line length < 60

Change-Id: I0c1b6b776cbb7c2b97d07a09e87cd6b0f2063656
(cherry picked from commit b84c966c007059a2dbcd54b11cb747ecca7dd22a)
---
M Checklist/Checklist.class.php
M Checklist/resources/BS.Checklist/Window.js
2 files changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Robert Vogel: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Checklist/Checklist.class.php b/Checklist/Checklist.class.php
index 31c5ff6..f6fb227 100644
--- a/Checklist/Checklist.class.php
+++ b/Checklist/Checklist.class.php
@@ -44,6 +44,7 @@
 
        public static $iCheckboxCounter = 0;
        public static $bCheckboxFound = false;
+       public static $iChecklistMaxItemLength = 60;
 
        protected function initExt() {
                wfProfileIn( 'BS::'.__METHOD__ );
@@ -103,10 +104,11 @@
                if ( is_object( $oTitle ) ) {
                        $oWikiPage = WikiPage::newFromID( 
$oTitle->getArticleID() );
                        if ( is_object( $oWikiPage ) ) {
-                               $sContent = 
$oWikiPage->getContent()->getNativeData();
-                               $aLines = explode( "\n", $sContent );
+                               $sContent = 
$oWikiPage->getContent()->preloadTransform( $oWikiPage->getTitle(), new 
ParserOptions() )->getNativeData();
+                               $aLines = explode( "\n", trim( $sContent ) );
                                foreach ( $aLines as $sLine ) {
-                                       if ( strpos( $sLine, '*' ) !== 0 ) 
continue;
+                                       if ( strpos( $sLine, '*' ) !== 0 ) 
return array();
+                                       if ( strlen( $sLine ) > 
self::$iChecklistMaxItemLength ) return array();
                                        $sNewLine = trim( substr( $sLine, 1 ) );
                                        $aOptions[] = $sNewLine;
                                }
diff --git a/Checklist/resources/BS.Checklist/Window.js 
b/Checklist/resources/BS.Checklist/Window.js
index c21e7d5..4255302 100644
--- a/Checklist/resources/BS.Checklist/Window.js
+++ b/Checklist/resources/BS.Checklist/Window.js
@@ -166,7 +166,7 @@
                */
        },
        onSelect: function( sender, records, index, eOpts) {
-               
+
                this.bsListItems.setValue( records.get( 'listOptions' ) );
                this.listSelected = records;
                this.setDirty( false );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0c1b6b776cbb7c2b97d07a09e87cd6b0f2063656
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_27
Gerrit-Owner: Robert Vogel <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to