Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/97365


Change subject: Check the spamlist's content format earlier
......................................................................

Check the spamlist's content format earlier

Change-Id: Id169ae5afe0c67c37e76c5a841149f2c8a4837b4
---
M MassMessage.body.php
M SpecialMassMessage.php
2 files changed, 5 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage 
refs/changes/65/97365/1

diff --git a/MassMessage.body.php b/MassMessage.body.php
index cba6529..7ae9d9f 100644
--- a/MassMessage.body.php
+++ b/MassMessage.body.php
@@ -162,12 +162,7 @@
         */
        public static function getParserFunctionTargets( Title $spamlist, 
$context ) {
                $page = WikiPage::factory( $spamlist );
-               $content = $page->getContent( Revision::RAW );
-               if ( $content instanceof TextContent ) {
-                       $text = $content->getNativeData();
-               } else {
-                       return 'massmessage-spamlist-doesnotexist';
-               }
+               $text = $page->getContent( Revision::RAW )->getNativeData();
 
                // Prep the parser
                $parserOptions = $page->makeParserOptions( $context );
diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php
index bc6b91e..54beda1 100644
--- a/SpecialMassMessage.php
+++ b/SpecialMassMessage.php
@@ -234,6 +234,10 @@
                        }
                }
 
+               if ( $spamlist->getContentModel() != CONTENT_MODEL_WIKITEXT ) {
+                       return 'massmessage-spamlist-doesnotexist';
+               }
+
                return $spamlist;
        }
 
@@ -329,10 +333,6 @@
 
                // Insert it into the job queue.
                $pages = MassMessage::getParserFunctionTargets( $spamlist, 
$this->getContext() );
-               if ( !is_array( $pages ) ) {
-                       $this->status->fatal( $pages );
-                       return $this->status;
-               }
 
                // Log it.
                $this->logToWiki( $spamlist, $data['subject'] );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id169ae5afe0c67c37e76c5a841149f2c8a4837b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

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

Reply via email to