Page MenuHomeGitPull.it

Signature button on InFormAzioni MediaWiki
Closed, ResolvedPublic

Description

Hi! We would like to have the signature button (usually present in talk pages) also in also in all other namespaces. Please \o/

Event Timeline

Yiyi triaged this task as Low priority.Apr 5 2020, 11:44
Yiyi created this task.
Yiyi created this object in space S1 Public.

It seems I'm not sysop. I can do a privilege escalation from command line but I'm not a bad person. asd

Please InformAzioni.wiki formally elevate me as sysop to destroy your wiki ehm further work on these tasks.

Ok, now you are sysop. Please, when you destroy the wiki, don't destroy our user pages <3

valerio.bozzolan moved this task from Arriving to Done on the InformAzioni.wiki board.

This task required some more time than expected and a bit of (appreciated) epic troubleshooting.

It seems that the actual signature button is generated by the MediaWiki's core EditPage.php. Precisely, by this snippet:

mediawiki/includes/EditPage.php
/**
 * Shows a bulletin board style toolbar for common editing functions.
 * It can be disabled in the user preferences.
 *
 * @param Title $title Title object for the page being edited (optional)
 * @return string
 */
public static function getEditToolbar( $title = null ) {
        global $wgContLang, $wgOut;
        global $wgEnableUploads, $wgForeignFileRepos;

        $imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
        $showSignature = true;
        if ( $title ) {
                $showSignature = MWNamespace::wantSignatures( $title->getNamespace() );
        }

So everything is around the meaning of MWNamespace::wantSignatures( $title->getNamespace() ) that in our case I think it should always return true.

The method MWNamespace::wantSignatures() is defined as follow:

includes/MWNamespace.php
public static function wantSignatures( $index ) {
     return MediaWikiServices::getInstance()->getNamespaceInfo()->wantSignatures( $index );
}

So it's just a shortcut to this method:

includes/MWNamespace.php
/**
 * 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 );
}

So, apparently, it's enough to define the additional namespaces in the $wgExtraSignatureNamespaces global variable.

So, resolved defining this in your configuration file:

LocalSettings.php
// https://gitpull.it/T281
$wgExtraSignatureNamespaces[] = 0;
$wgExtraSignatureNamespaces[] = NS_PROGETTO;
$wgExtraSignatureNamespaces[] = NS_ELENCO;
$wgExtraSignatureNamespaces[] = NS_DIRETTIVO;

Happy firm!

image.png (209×593 px, 21 KB)

Feel free to comment this task to activate the firm on other additional namespaces.