Glaisher has uploaded a new change for review.

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

Change subject: Show an editnotice on local page if a global userpage is 
currently shown
......................................................................

Show an editnotice on local page if a global userpage is currently shown

Bug: T88779
Change-Id: Ie4588dbcf50f0c3c925ccb0489d7a3b3032b75f0
---
M GlobalUserPage.hooks.php
M GlobalUserPage.php
M i18n/en.json
M i18n/qqq.json
4 files changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalUserPage 
refs/changes/22/189522/1

diff --git a/GlobalUserPage.hooks.php b/GlobalUserPage.hooks.php
index 3b9618f..445dc77 100644
--- a/GlobalUserPage.hooks.php
+++ b/GlobalUserPage.hooks.php
@@ -91,4 +91,18 @@
 
                return true;
        }
+
+       /**
+        * Show an edit notice on user pages which displays global user pages.
+        *
+        * @param Title $title
+        * @param integer $oldid
+        * @param array &$notices
+        */
+       public static function displayGlobalUserPageEditNotice( Title $title, 
$oldid, array &$notices ) {
+               if ( !$title->exists() && 
GlobalUserPage::shouldDisplayGlobalPage( $title ) ) {
+                       $notices['globaluserpage'] = wfMessage( 
'globaluserpage-editnotice' )->parseAsBlock();
+               }
+               return true;
+       }
 }
diff --git a/GlobalUserPage.php b/GlobalUserPage.php
index ca465af..f7069a0 100644
--- a/GlobalUserPage.php
+++ b/GlobalUserPage.php
@@ -88,6 +88,7 @@
 $wgHooks['SkinTemplateNavigation::Universal'][] = 
'GlobalUserPageHooks::onSkinTemplateNavigationUniversal';
 $wgHooks['LinkBegin'][] = 'GlobalUserPageHooks::brokenLink';
 $wgHooks['ArticleFromTitle'][] = 'GlobalUserPageHooks::onArticleFromTitle';
+$wgHooks['TitleGetEditNotices'][] = 
'GlobalUserPageHooks::displayGlobalUserPageEditNotice';
 
 // Register the CSS as a module with ResourceLoader
 $wgResourceModules['ext.GlobalUserPage'] = array(
diff --git a/i18n/en.json b/i18n/en.json
index b897b09..bd3621c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,6 +5,7 @@
                ]
        },
        "globaluserpage-desc": "Automatically fetches user pages from a central 
wiki",
+       "globaluserpage-editnotice": "<strong>This page currently displays a 
user page from another wiki. If you create a new page here, it will be 
overridden with the newly created page.</strong>",
        "globaluserpage-preferences": "Use 
[https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:GlobalUserPage
 global user page]",
        "globaluserpage-footer": "What you see on this page was 
[https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:GlobalUserPage
 copied] from [$2 $2]."
-}
+}
\ No newline at end of file
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 36bd9df..7296b61 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -6,6 +6,7 @@
                ]
        },
        "globaluserpage-desc": 
"{{desc|name=GlobalUserPage|url=https://www.mediawiki.org/wiki/Extension:GlobalUserPage}}";,
+       "globaluserpage-editnotice": "Edit notice displayed on user pages if it 
currently shows a global user page.",
        "globaluserpage-preferences": "Used as checkbox label in 
[[Special:GlobalPreferences]].",
        "globaluserpage-footer": "Footer shown on global user pages. 
Parameters:\n* $1 - the user's name\n* $2 - a link to the original user page on 
the central wiki"
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4588dbcf50f0c3c925ccb0489d7a3b3032b75f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalUserPage
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>

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

Reply via email to