jenkins-bot has submitted this change and it was merged.
Change subject: Hide edit toolbar Signature button in non-discussion namespaces
......................................................................
Hide edit toolbar Signature button in non-discussion namespaces
Most wikis only use user signatures on pages set aside from discussion,
(Talk namespaces and sometimes project/main namespaces depending on
the wiki), so having the button available everywhere is confusing.
The few wikis that need the button (especially non-content,
internal/corporate/planning wikis), can add relevant namespaces to the
$wgExtraSignatureNamespaces array in LocalSettings.
This would make it possible to solve bugs like T59727 or T53154.
Since this is a change to default behavior, a release note is added.
Bug: T7645
Change-Id: I7ccf1093b888c7b33721234349ca0ac054c3cd3f
---
M RELEASE-NOTES-1.26
M includes/DefaultSettings.php
M includes/EditPage.php
M includes/MWNamespace.php
M includes/resourceloader/ResourceLoaderStartUpModule.php
5 files changed, 35 insertions(+), 4 deletions(-)
Approvals:
Kaldari: Looks good to me, approved
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 11da802..bbd63b5 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -16,6 +16,10 @@
use the 'rawcontinue' parameter to receive raw query-continue data, but the
new style is encouraged as it's harder to implement incorrectly.
* Deprecated API formats dump and wddx have been completely removed.
+* (T7645) The "Signature" button on the edit toolbar is now hidden by default
+ in non-talk namespaces. A new configuration variable,
+ $wgExtraSignatureNamespaces, controls in which subject (non-talk) namespaces
+ the "Signature" button on the edit toolbar will be displayed.
* $wgResourceLoaderUseESI was deprecated and removed. This was an experimental
feature that was never enabled by default.
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 4d1b329..53137a6 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -3963,6 +3963,15 @@
$wgContentNamespaces = array( NS_MAIN );
/**
+ * Array of namespaces, in addition to the talk namespaces, where signatures
+ * (~~~~) are likely to be used. This determines whether to display the
+ * Signature button on the edit toolbar, and may also be used by extensions.
+ * For example, "traditional" style wikis, where content and discussion are
+ * intermixed, could place NS_MAIN and NS_PROJECT namespaces in this array.
+ */
+$wgExtraSignatureNamespaces = array();
+
+/**
* Max number of redirects to follow when resolving redirects.
* 1 means only the first redirect is followed (default behavior).
* 0 or less means no redirects are followed.
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 0233b11..0ca2f80 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2545,7 +2545,7 @@
$wgOut->addHTML( $this->editFormTextBeforeContent );
if ( !$this->isCssJsSubpage && $showToolbar &&
$wgUser->getOption( 'showtoolbar' ) ) {
- $wgOut->addHTML( EditPage::getEditToolbar() );
+ $wgOut->addHTML( EditPage::getEditToolbar(
$this->mTitle ) );
}
if ( $this->blankArticle ) {
@@ -3686,13 +3686,18 @@
* Shows a bulletin board style toolbar for common editing functions.
* It can be disabled in the user preferences.
*
+ * @param $title Title object for the page being edited (optional)
* @return string
*/
- static function getEditToolbar() {
+ static function getEditToolbar( $title = null ) {
global $wgContLang, $wgOut;
global $wgEnableUploads, $wgForeignFileRepos;
$imagesAvailable = $wgEnableUploads || count(
$wgForeignFileRepos );
+ $showSignature = true;
+ if ( $title ) {
+ $showSignature = MWNamespace::wantSignatures(
$title->getNamespace() );
+ }
/**
* $toolarray is an array of arrays each of which includes the
@@ -3760,13 +3765,13 @@
'sample' => wfMessage( 'nowiki_sample'
)->text(),
'tip' => wfMessage( 'nowiki_tip' )->text(),
),
- array(
+ $showSignature ? array(
'id' => 'mw-editbutton-signature',
'open' => '--~~~~',
'close' => '',
'sample' => '',
'tip' => wfMessage( 'sig_tip' )->text(),
- ),
+ ) : false,
array(
'id' => 'mw-editbutton-hr',
'open' => "\n----\n",
diff --git a/includes/MWNamespace.php b/includes/MWNamespace.php
index bd68551..731b62e 100644
--- a/includes/MWNamespace.php
+++ b/includes/MWNamespace.php
@@ -297,6 +297,18 @@
}
/**
+ * Might pages in this namespace require the use of the Signature
button on
+ * the edit toolbar?
+ *
+ * @param int $index Index to check
+ * @return bool
+ */
+ public static function wantSignatures( $index ) {
+ global $wgExtraSignatureNamespaces;
+ return self::isTalk( $index ) || in_array( $index,
$wgExtraSignatureNamespaces );
+ }
+
+ /**
* Can pages in a namespace be watched?
*
* @param int $index
diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php
b/includes/resourceloader/ResourceLoaderStartUpModule.php
index 16424a0..2936d76 100644
--- a/includes/resourceloader/ResourceLoaderStartUpModule.php
+++ b/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -88,6 +88,7 @@
'wgContentNamespaces' =>
MWNamespace::getContentNamespaces(),
'wgSiteName' => $conf->get( 'Sitename' ),
'wgDBname' => $conf->get( 'DBname' ),
+ 'wgExtraSignatureNamespaces' => $conf->get(
'ExtraSignatureNamespaces' ),
'wgAvailableSkins' => Skin::getSkinNames(),
'wgExtensionAssetsPath' => $conf->get(
'ExtensionAssetsPath' ),
// MediaWiki sets cookies to have this prefix by default
--
To view, visit https://gerrit.wikimedia.org/r/87649
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7ccf1093b888c7b33721234349ca0ac054c3cd3f
Gerrit-PatchSet: 21
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TTO <[email protected]>
Gerrit-Reviewer: GOIII <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Peachey88 <[email protected]>
Gerrit-Reviewer: TTO <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits