Bsitu has uploaded a new change for review.

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


Change subject: email digest notificaiton should be logged as well for metrics
......................................................................

email digest notificaiton should be logged as well for metrics

Change-Id: I3ba12431588013454c191f5561d127168ffac599
---
M Notifier.php
1 file changed, 4 insertions(+), 8 deletions(-)


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

diff --git a/Notifier.php b/Notifier.php
index 22d730f..3a4d326 100644
--- a/Notifier.php
+++ b/Notifier.php
@@ -78,8 +78,8 @@
         * @return bool
         */
        public static function notifyWithEmail( $user, $event ) {
-               if ( !$user->isEmailConfirmed() ) {
-                       // No valid email address
+               // No valid email address or email notification
+               if ( !$user->isEmailConfirmed() || $user->getOption( 
'echo-email-frequency' ) < 0 ) {
                        return false;
                }
 
@@ -100,6 +100,8 @@
                                $bundleHash = md5( $bundleString );
                        }
 
+                       self::logEvent( $user, $event, 'email' );
+
                        // email digest notification ( weekly or daily )
                        if ( $wgEchoEnableEmailBatch && $user->getOption( 
'echo-email-frequency' ) > 0 ) {
                                // always create a unique event hash for those 
events don't support bundling
@@ -110,14 +112,8 @@
                                MWEchoEmailBatch::addToQueue( $user->getId(), 
$event->getId(), $priority, $bundleHash );
                                return true;
                        }
-                       // no email notification
-                       if ( $user->getOption( 'echo-email-frequency' ) < 0 ) {
-                               return false;
-                       }
 
                        $addedToQueue = false;
-
-                       self::logEvent( $user, $event, 'email' );
 
                        // only send bundle email if email bundling is on
                        if ( $wgEchoBundleEmailInterval && $bundleHash && 
!empty( $wgEchoNotifications[$event->getType()]['bundle']['email'] ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ba12431588013454c191f5561d127168ffac599
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>

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

Reply via email to