jenkins-bot has submitted this change and it was merged.

Change subject: Surround edit notices with appropriate classes
......................................................................


Surround edit notices with appropriate classes

This commit adds a <div> around edit notices with relevant classes to aid in the
creation of user scripts, following an earlier change (bug 30959) for
edit intros.

It adds an .mw-editnotice class to each edit notice, and because classes are 
fairly
cheap, a second mirroring the edit notice's message key, and a third depending
on the edit notice type:
        .mw-editnotice-namespace        for a namespace-wide edit notice
        .mw-editnotice-base             for a edit notice for the subpage's 
base page
        .mw-editnotice-page             for an edit notice set explicitly for 
the page

Classes are sanitized where required.

Bug: 68749
Change-Id: Idf44f2a344d64893f799286914bda3f8d4aff6bf
---
M includes/Title.php
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  TTO: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/Title.php b/includes/Title.php
index a1b2352..b25676c 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -5007,7 +5007,9 @@
                $editnotice_ns = 'editnotice-' . $this->getNamespace();
                $editnotice_ns_message = wfMessage( $editnotice_ns );
                if ( $editnotice_ns_message->exists() ) {
-                       $notices[$editnotice_ns] = 
$editnotice_ns_message->parseAsBlock();
+                       $notices[$editnotice_ns] = '<div class="mw-editnotice 
mw-editnotice-namespace ' .
+                               Sanitizer::escapeClass( "mw-$editnotice_ns" ) . 
'">' .
+                               $editnotice_ns_message->parseAsBlock() . 
'</div>';
                }
                if ( MWNamespace::hasSubpages( $this->getNamespace() ) ) {
                        $parts = explode( '/', $this->getDBkey() );
@@ -5016,7 +5018,9 @@
                                $editnotice_base .= '-' . array_shift( $parts );
                                $editnotice_base_msg = wfMessage( 
$editnotice_base );
                                if ( $editnotice_base_msg->exists() ) {
-                                       $notices[$editnotice_base] = 
$editnotice_base_msg->parseAsBlock();
+                                       $notices[$editnotice_base] = '<div 
class="mw-editnotice mw-editnotice-base ' .
+                                               Sanitizer::escapeClass( 
"mw-$editnotice_base" ) . '">' .
+                                               
$editnotice_base_msg->parseAsBlock() . '</div>';
                                }
                        }
                } else {
@@ -5024,7 +5028,9 @@
                        $editnoticeText = $editnotice_ns . '-' . str_replace( 
'/', '-', $this->getDBkey() );
                        $editnoticeMsg = wfMessage( $editnoticeText );
                        if ( $editnoticeMsg->exists() ) {
-                               $notices[$editnoticeText] = 
$editnoticeMsg->parseAsBlock();
+                               $notices[$editnoticeText] = '<div 
class="mw-editnotice mw-editnotice-page ' .
+                                       Sanitizer::escapeClass( 
"mw-$editnoticeText" ) . '">' .
+                                       $editnoticeMsg->parseAsBlock() . 
'</div>';
                        }
                }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf44f2a344d64893f799286914bda3f8d4aff6bf
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Microchip08 <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Microchip08 <[email protected]>
Gerrit-Reviewer: TTO <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to