Wctaiwan has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/142498

Change subject: Make site handling more consistent
......................................................................

Make site handling more consistent

Never store the site for local pages, instead having
Special:EditMassMessageList decide whether to add it on output.

Change-Id: I04c6ab7281ba9238934181b19c3bcb2b42b2d524
---
M includes/SpecialEditMassMessageList.php
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage 
refs/changes/98/142498/1

diff --git a/includes/SpecialEditMassMessageList.php 
b/includes/SpecialEditMassMessageList.php
index 877ef8f..1d28014 100644
--- a/includes/SpecialEditMassMessageList.php
+++ b/includes/SpecialEditMassMessageList.php
@@ -152,10 +152,14 @@
         * @return string
         */
        protected static function parseTargets( $targets ) {
+               global $wgServerName;
+
                $lines = array();
                foreach ( $targets as $target ) {
                        if ( array_key_exists( 'site', $target ) ) {
                                $lines[] = $target['title'] . '@' . 
$target['site'];
+                       } elseif ( strpos( $target['title'], '@' ) !== false ) {
+                               $lines[] = $target['title'] . '@' . 
$wgServerName; // List site where ambiguous.
                        } else {
                                $lines[] = $target['title'];
                        }
@@ -169,7 +173,7 @@
         * @return array|null
         */
        protected static function parseInput( $input ) {
-               global $wgAllowGlobalMessaging;
+               global $wgServerName, $wgAllowGlobalMessaging;
 
                $lines = array_filter( explode( "\n", $input ), 'trim' ); // 
Array of non-empty lines
 
@@ -179,6 +183,9 @@
                        if ( $delimiterPos !== false ) {
                                $titleText = substr( $line, 0, $delimiterPos );
                                $site = strtolower( substr( $line, 
$delimiterPos+1 ) );
+                               if ( $site === $wgServerName ) {
+                                       $site = null; // Don't store site for 
local pages.
+                               }
                        } else {
                                $titleText = $line;
                                $site = null;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04c6ab7281ba9238934181b19c3bcb2b42b2d524
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: contenthandler
Gerrit-Owner: Wctaiwan <wctai...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to