jenkins-bot has submitted this change and it was merged.
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, 9 insertions(+), 6 deletions(-)
Approvals:
Bsitu: Looks good to me, approved
jenkins-bot: Verified
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/159804
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If803ecea2cf501edb5e5f6073a41f631ce88e8fe
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits