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

Change subject: Support for redirects upon page move
......................................................................


Support for redirects upon page move

Change-Id: I46c09d35ab532afc7d96b77531ebc348efbf52aa
---
M includes/content/CollaborationHubContent.php
M includes/content/CollaborationHubContentHandler.php
M includes/content/CollaborationListContentHandler.php
3 files changed, 52 insertions(+), 1 deletion(-)

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



diff --git a/includes/content/CollaborationHubContent.php 
b/includes/content/CollaborationHubContent.php
index dfb0d33..e0c649d 100644
--- a/includes/content/CollaborationHubContent.php
+++ b/includes/content/CollaborationHubContent.php
@@ -352,7 +352,7 @@
 
                $membersPageName = $title->getFullText() . '/' . wfMessage( 
'collaborationkit-hub-pagetitle-members' )->inContentLanguage()->text();
                $membersTitle = Title::newFromText( $membersPageName );
-               if ( $membersTitle->exists() || $membersContent !== null ) {
+               if ( ( $membersTitle->exists() && 
$membersTitle->getContentModel() == 'CollaborationListContent' ) || 
$membersContent !== null ) {
                        $membersPageID = $membersTitle->getArticleID();
                        $output->addJsConfigVars( 
'wgCollaborationKitAssociatedMemberList', $membersPageID );
 
diff --git a/includes/content/CollaborationHubContentHandler.php 
b/includes/content/CollaborationHubContentHandler.php
index 0df3534..6d7c704 100644
--- a/includes/content/CollaborationHubContentHandler.php
+++ b/includes/content/CollaborationHubContentHandler.php
@@ -105,6 +105,29 @@
        }
 
        /**
+        * @return bool
+        */
+       public function supportsRedirects() {
+               return true;
+       }
+
+       /**
+        * Turns CollaborationHubContent page into redirect
+        *
+        * Note that wikitext redirects are created, as generally, this content 
model
+        * is used in namespaces that support wikitext, and wikitext redirects 
are
+        * expected.
+        *
+        * @param Title $destination The page to redirect to
+        * @param string $text Text to include in the redirect.
+        * @return Content
+        */
+       public function makeRedirectContent( Title $destination, $text = '' ) {
+               $handler = new WikitextContentHandler();
+               return $handler->makeRedirectContent( $destination, $text );
+       }
+
+       /**
         * Edit a Collaboration Hub via the edit API
         * @param Title $title
         * @param string $displayName
diff --git a/includes/content/CollaborationListContentHandler.php 
b/includes/content/CollaborationListContentHandler.php
index d8f11c3..b443d04 100644
--- a/includes/content/CollaborationListContentHandler.php
+++ b/includes/content/CollaborationListContentHandler.php
@@ -129,9 +129,37 @@
                return false;
        }
 */
+
+       /**
+        * @return bool
+        */
        public function supportsDirectApiEditing() {
                return true;
        }
+
+       /**
+        * @return bool
+        */
+       public function supportsRedirects() {
+               return true;
+       }
+
+       /**
+        * Turns CollaborationListContent page into redirect
+        *
+        * Note that wikitext redirects are created, as generally, this content 
model
+        * is used in namespaces that support wikitext, and wikitext redirects 
are
+        * expected.
+        *
+        * @param Title $destination The page to redirect to
+        * @param string $text Text to include in the redirect.
+        * @return Content
+        */
+       public function makeRedirectContent( Title $destination, $text = '' ) {
+               $handler = new WikitextContentHandler();
+               return $handler->makeRedirectContent( $destination, $text );
+       }
+
        /**
         * Posts the newly created "members" list on-wiki.
         *

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I46c09d35ab532afc7d96b77531ebc348efbf52aa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Harej <jamesmh...@gmail.com>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Isarra <zhoris...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to