EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/159908
Change subject: Limit notifications to 20 per post
......................................................................
Limit notifications to 20 per post
Change-Id: If803ecea2cf501edb5e5f6073a41f631ce88e8fe
(cherry picked from commit 1047d476c5efc724d5cfa476704f7c2a874a408b)
---
M includes/Notifications/Controller.php
1 file changed, 9 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/08/159908/1
diff --git a/includes/Notifications/Controller.php
b/includes/Notifications/Controller.php
index 604fecc..39809c3 100644
--- a/includes/Notifications/Controller.php
+++ b/includes/Notifications/Controller.php
@@ -243,10 +243,6 @@
$events = array();
$mentionedUsers = $newRevision ? $this->getMentionedUsers(
$newRevision, $title ) : array();
- // Notify only a portion of the mentioned users.
- // For starters, this could be a spam vector, but we also don't
want to
- // store too much data into event_extra params, so cap that data
- $mentionedUsers = array_slice( $mentionedUsers, 0, 100, true );
if ( !$topicRevision instanceof PostRevision ) {
throw new FlowException( 'Expected PostRevision but
received: ' . get_class( $topicRevision ) );
@@ -354,8 +350,15 @@
$users = array();
foreach ( $links[NS_USER] as $dbk => $page_id ) {
$user = User::newFromName( $dbk );
- if ( $user ) {
- $users[] = $user;
+ if ( !$user || $user->isAnon() ) {
+ continue;
+ }
+
+ $users[$user->getId()] = $user;
+ // If more than 20 users are being notified this is
probably a spam/attack vector.
+ // Don't send any mention notifications
+ if ( count( $users ) > 20 ) {
+ return array();
}
}
--
To view, visit https://gerrit.wikimedia.org/r/159908
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If803ecea2cf501edb5e5f6073a41f631ce88e8fe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: wmf/1.24wmf21
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits