Addshore has uploaded a new change for review.

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

Change subject: Track why mentions didn't happen
......................................................................

Track why mentions didn't happen

Right now we don't actually know how many times
each of these cases happen so add some basic tracking
so we can make some informed decisions.

Bug: T135719
Change-Id: Id4d519aefe96ecca2e3c51dd1c8128de70d0caac
---
M includes/DiscussionParser.php
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/62/290062/1

diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php
index 909723b..0e7d4a1 100644
--- a/includes/DiscussionParser.php
+++ b/includes/DiscussionParser.php
@@ -157,6 +157,16 @@
                                !$user || $user->isAnon() || $user->getId() == 
$revision->getUser() ||
                                ( $title->getNamespace() === NS_USER_TALK && 
$title->getDBkey() === $dbk )
                        ) {
+                               $stats = RequestContext::getMain()->getStats();
+                               if ( $user->isAnon() ) {
+                                       $stats->increment( 
'echo.event.mention.error.anonUser' );
+                               }
+                               if ( $user->getId() == $revision->getUser() ) {
+                                       $stats->increment( 
'echo.event.mention.error.sameUser' );
+                               }
+                               if ( $title->getNamespace() === NS_USER_TALK && 
$title->getDBkey() === $dbk ) {
+                                       $stats->increment( 
'echo.event.mention.error.ownPage' );
+                               }
                                continue;
                        }
                        $mentionedUsers[$user->getId()] = $user->getId();
@@ -164,6 +174,8 @@
                        // If more than 50 users are being pinged this is 
likely a spam/attack vector
                        // Don't send any mention notifications.
                        if ( $count > 50 ) {
+                               $stats = RequestContext::getMain()->getStats();
+                               $stats->increment( 
'echo.event.mention.error.tooMany' );
                                return;
                        }
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4d519aefe96ecca2e3c51dd1c8128de70d0caac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>

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

Reply via email to