EBernhardson has uploaded a new change for review.

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

Change subject: Limit notifications to 20 per post
......................................................................

Limit notifications to 20 per post

Change-Id: If803ecea2cf501edb5e5f6073a41f631ce88e8fe
---
M includes/Notifications/Controller.php
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/04/159804/1

diff --git a/includes/Notifications/Controller.php 
b/includes/Notifications/Controller.php
index 604fecc..77e11ef 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 ) );
@@ -357,6 +353,11 @@
                        if ( $user ) {
                                $users[] = $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();
+                       }
                }
 
                return $users;

-- 
To view, visit https://gerrit.wikimedia.org/r/159804
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: master
Gerrit-Owner: EBernhardson <[email protected]>

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

Reply via email to