jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/333964 )
Change subject: Added clear error message when SocialProfile extension is not installed. ...................................................................... Added clear error message when SocialProfile extension is not installed. Bug: T155405 Change-Id: I2a756bff6a6a131275bc568dc18aab703390a472 --- M SpecialAdminPoll.php M SpecialCreatePoll.php M SpecialUpdatePoll.php M i18n/en.json M i18n/qqq.json 5 files changed, 24 insertions(+), 2 deletions(-) Approvals: Jack Phoenix: Looks good to me, approved jenkins-bot: Verified diff --git a/SpecialAdminPoll.php b/SpecialAdminPoll.php index 2182aac..76cde69 100644 --- a/SpecialAdminPoll.php +++ b/SpecialAdminPoll.php @@ -30,6 +30,12 @@ $request = $this->getRequest(); $user = $this->getUser(); + // https://phabricator.wikimedia.org/T155405 + // Throws error message when SocialProfile extension is not installed + if( !class_exists( 'UserStats' ) ) { + throw new ErrorPageError( 'poll-error-socialprofile-title', 'poll-error-socialprofile' ); + } + // If the user doesn't have the required permission, display an error if( !$user->isAllowed( 'polladmin' ) ) { throw new PermissionsError( 'polladmin' ); @@ -306,4 +312,4 @@ protected function getGroupName() { return 'poll'; } -} \ No newline at end of file +} diff --git a/SpecialCreatePoll.php b/SpecialCreatePoll.php index 0445126..32815f7 100644 --- a/SpecialCreatePoll.php +++ b/SpecialCreatePoll.php @@ -31,6 +31,12 @@ $wgSupressPageTitle = true; + // https://phabricator.wikimedia.org/T155405 + // Throws error message when SocialProfile extension is not installed + if( !class_exists( 'UserStats' ) ) { + throw new ErrorPageError( 'poll-error-socialprofile-title', 'poll-error-socialprofile' ); + } + // Blocked users cannot create polls if( $user->isBlocked() ) { throw new UserBlockedError( $user->getBlock() ); diff --git a/SpecialUpdatePoll.php b/SpecialUpdatePoll.php index f198937..5f7ee29 100644 --- a/SpecialUpdatePoll.php +++ b/SpecialUpdatePoll.php @@ -19,6 +19,12 @@ $request = $this->getRequest(); $user = $this->getUser(); + // https://phabricator.wikimedia.org/T155405 + // Throws error message when SocialProfile extension is not installed + if( !class_exists( 'UserStats' ) ) { + throw new ErrorPageError( 'poll-error-socialprofile-title', 'poll-error-socialprofile' ); + } + // Show a message if the database is in read-only mode if ( wfReadOnly() ) { $out->readOnlyPage(); @@ -202,4 +208,4 @@ </div>"; return $form; } -} \ No newline at end of file +} diff --git a/i18n/en.json b/i18n/en.json index f50bfd1..cd22b6b 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -14,6 +14,8 @@ "poll-admin-closed": "Closed", "poll-admin-flagged": "Flagged", "poll-admin-open": "Open", + "poll-error-socialprofile": "[https://www.mediawiki.org/wiki/Extension:SocialProfile SocialProfile extension] is not installed. Please install this extension and try again.", + "poll-error-socialprofile-title": "SocialProfile extension is not installed.", "poll-admin-panel": "Admin", "poll-admin-status-nav": "Filter by status", "poll-admin-title-all": "Poll admin - View all polls", diff --git a/i18n/qqq.json b/i18n/qqq.json index 6c37f56..25bc157 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -18,6 +18,8 @@ "poll-admin-closed": "Link title; clicking on this link shows all closed polls.\n{{Identical|Closed}}", "poll-admin-flagged": "Link title; clicking on this link shows all flagged polls.\n{{Identical|Flagged}}", "poll-admin-open": "Link title; clicking on this link shows all open polls.\n{{Identical|Open}}", + "poll-error-socialprofile": "Error message shown when SocialProfle extension is not installed.", + "poll-error-socialprofile-title": "Title for <code>poll-error-socialprofile</code>.", "poll-admin-panel": "Title of the admin panel link; shown on all Poll: pages, below the box {{msg-mw|poll-submitted-by}}.\n{{Identical|Admin}}", "poll-admin-status-nav": "Title of the right-hand navigation menu on [[Special:AdminPoll]].\n\nFollowed by the following link texts:\n* {{msg-mw|Poll-admin-viewall}}\n* {{msg-mw|Poll-admin-open}}\n* {{msg-mw|Poll-admin-closed}}\n* {{msg-mw|Poll-admin-flagged}}", "poll-admin-title-all": "Default title of [[Special:AdminPoll]].\n{{Related|Poll-admin-title}}", -- To view, visit https://gerrit.wikimedia.org/r/333964 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2a756bff6a6a131275bc568dc18aab703390a472 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/PollNY Gerrit-Branch: master Gerrit-Owner: Filip <r...@protonmail.com> Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net> Gerrit-Reviewer: SamanthaNguyen <codynguyen1...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits