jenkins-bot has submitted this change and it was merged.

Change subject: Redirect editing of jump wiki polls to central wiki
......................................................................


Redirect editing of jump wiki polls to central wiki

The code is already set up to assume this is being done,
so no good is likely to come of trying to edit the jump
wiki poll directly.

Change-Id: Ifb2952d46364b4a04a23cc95c8365b9ca3eed518
---
M i18n/en.json
M i18n/qqq.json
M includes/pages/CreatePage.php
3 files changed, 29 insertions(+), 0 deletions(-)

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



diff --git a/i18n/en.json b/i18n/en.json
index 2635c25..151bc6a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -195,6 +195,8 @@
        "securepoll-create-fail-bad-dblist": "The specified wiki or wiki list 
is not valid",
        "securepoll-create-duplicate-title": "The given poll title has already 
been used on $1",
        "securepoll-edit-title": "{{int:securepoll}}: Edit poll",
+       "securepoll-edit-redirect": "This election must be configured on $1",
+       "securepoll-edit-redirect-otherwiki": "the main wiki",
        "securepoll-edit-action": "Edit poll",
        "securepoll-edit-edited": "{{int:securepoll}}: Poll edited",
        "securepoll-edit-edited-text": "Your poll has been edited.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index fefc122..827a07c 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -173,6 +173,8 @@
        "securepoll-create-fail-bad-dblist": "Used as error message in 
Special:SecurePoll/create.",
        "securepoll-create-duplicate-title": "Used as error message in 
Special:SecurePoll/create.",
        "securepoll-edit-title": "Title for 
[[Special:SecurePoll/edit]].\n\nRefers to {{msg-mw|Securepoll}}.",
+       "securepoll-edit-redirect": "Text displayed when trying to edit a 
multi-wiki poll on the wrong wiki.\n\nParameters:\n* $1 - HTML of a link to the 
correct wiki. Displayed text is either the wiki name or 
{{msg-mw|securepoll-edit-redirect-otherwiki}}",
+       "securepoll-edit-redirect-otherwiki": "Used with 
{{msg-mw|securepoll-votereligibility-redirect}} when no name is available for 
the target wiki.",
        "securepoll-edit-action": "Text for submit button on 
Special:SecurePoll/edit.\n{{Identical|Edit poll}}",
        "securepoll-edit-edited": "Title for the page displayed after poll 
edit.\n\nRefers to {{msg-mw|Securepoll}}.\n\nSee also:\n* 
{{msg-mw|Securepoll-edit-edited-text}}",
        "securepoll-edit-edited-text": "Text for the page displayed after poll 
edit.\n\nSee also:\n* {{msg-mw|Securepoll-edit-edited}}",
diff --git a/includes/pages/CreatePage.php b/includes/pages/CreatePage.php
index 53242a0..91219c5 100644
--- a/includes/pages/CreatePage.php
+++ b/includes/pages/CreatePage.php
@@ -26,6 +26,31 @@
                                $out->addWikiMsg( 'securepoll-need-admin' );
                                return;
                        }
+
+                       $jumpUrl = $this->election->getProperty( 'jump-url' );
+                       if ( $jumpUrl ) {
+                               $jumpId = $this->election->getProperty( 
'jump-id' );
+                               if ( !$jumpId ) {
+                                       throw new MWException( 'Configuration 
error: no jump-id' );
+                               }
+                               $jumpUrl .= "/edit/$jumpId";
+                               if ( count( $params ) > 1 ) {
+                                       $jumpUrl .= '/' . join( '/', 
array_slice( $params, 1 ) );
+                               }
+
+                               $wiki = $this->election->getProperty( 
'main-wiki' );
+                               if ( $wiki ) {
+                                       $wiki = WikiMap::getWikiName( $wiki );
+                               } else {
+                                       $wiki = $this->msg( 
'securepoll-edit-redirect-otherwiki' )->text();
+                               }
+
+                               $out->addWikiMsg( 'securepoll-edit-redirect',
+                                       Message::rawParam( 
Linker::makeExternalLink( $jumpUrl, $wiki ) )
+                               );
+
+                               return;
+                       }
                } else {
                        $out->setPageTitle( $this->msg( 
'securepoll-create-title' ) );
                        if ( !$wgUser->isAllowed( 'securepoll-create-poll' ) ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb2952d46364b4a04a23cc95c8365b9ca3eed518
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to