Legoktm has uploaded a new change for review.

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


Change subject: Add a primitive de-duping feature when getting local pagelinks.
......................................................................

Add a primitive de-duping feature when getting local pagelinks.

Since we automatically convert some namespaces through $wgNamespacesToConvert,
a user could add [[User:Admin]] and [[User talk:Admin]] to a spamlist, resulting
in duplicate notifications. Now it checks if the page title is already in the 
array,
and if so, don't add it again.

Change-Id: Ib642961f1e74b3d3fe64e18e8717dc6d1f0dd18b
---
M SpecialMassMessage.php
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php
index a5f9b80..4a36177 100644
--- a/SpecialMassMessage.php
+++ b/SpecialMassMessage.php
@@ -102,7 +102,10 @@
                        if ( isset( $wgNamespacesToConvert[$ns] ) ) {
                                $ns = $wgNamespacesToConvert[$ns];
                        }
-                       $pages[] = Title::makeTitle( $ns, $row->pl_title );
+                       $title = Title::makeTitle( $ns, $row->pl_title );
+                       if ( !in_array($title, $pages) ) {
+                               $pages[] = $title;
+                       }
                }
                return $pages;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib642961f1e74b3d3fe64e18e8717dc6d1f0dd18b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

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

Reply via email to