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
This commit is contained in:
parent
f318d7a04b
commit
b3f897e971
5 changed files with 35 additions and 4 deletions
|
|
@ -16,6 +16,10 @@ production.
|
|||
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.
|
||||
|
||||
|
|
|
|||
|
|
@ -3962,6 +3962,15 @@ $wgTrackingCategories = array();
|
|||
*/
|
||||
$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).
|
||||
|
|
|
|||
|
|
@ -2545,7 +2545,7 @@ class EditPage {
|
|||
$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 @@ HTML
|
|||
* 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 @@ HTML
|
|||
'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",
|
||||
|
|
|
|||
|
|
@ -296,6 +296,18 @@ class MWNamespace {
|
|||
return $index == NS_MAIN || in_array( $index, $wgContentNamespaces );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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?
|
||||
*
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
|
|||
'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
|
||||
|
|
|
|||
Loading…
Reference in a new issue