http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88380

Revision: 88380
Author:   jeroendedauw
Date:     2011-05-18 18:45:39 +0000 (Wed, 18 May 2011)
Log Message:
-----------
turn off email limiting for now

Modified Paths:
--------------
    trunk/extensions/SemanticWatchlist/SemanticWatchlist.hooks.php
    trunk/extensions/SemanticWatchlist/SemanticWatchlist.settings.php
    trunk/extensions/SemanticWatchlist/includes/SWL_Emailer.php

Modified: trunk/extensions/SemanticWatchlist/SemanticWatchlist.hooks.php
===================================================================
--- trunk/extensions/SemanticWatchlist/SemanticWatchlist.hooks.php      
2011-05-18 18:10:40 UTC (rev 88379)
+++ trunk/extensions/SemanticWatchlist/SemanticWatchlist.hooks.php      
2011-05-18 18:45:39 UTC (rev 88380)
@@ -51,6 +51,8 @@
      * @return true
      */    
     public static function onGroupNotify( SWLGroup $group, array $userIDs, 
SWLChangeSet $changes ) {
+       global $egSWLMailPerChange;
+       
        foreach ( $userIDs as $userID ) {
                $user = User::newFromId( $userID );
                
@@ -61,8 +63,8 @@
                        if ( is_null( $lastNotify ) || is_null( $lastWatch ) || 
$lastNotify < $lastWatch ) {
                                $mailCount = $user->getOption( 
'swl_mail_count', 0 );
                                
-                               if ( $mailCount < $egSWLMaxMails ) {
-                                       SWLEmailer::notifyUser( $group, $user, 
$changes );
+                               if ( $egSWLMailPerChange || $mailCount < 
$egSWLMaxMails ) {
+                                       SWLEmailer::notifyUser( $group, $user, 
$changes, $egSWLMailPerChange );
                                        $user->setOption( 'swl_last_notify', 
wfTimestampNow() );
                                        $user->setOption( 'swl_mail_count', 
$mailCount + 1 );
                                        $user->saveSettings();                  
                

Modified: trunk/extensions/SemanticWatchlist/SemanticWatchlist.settings.php
===================================================================
--- trunk/extensions/SemanticWatchlist/SemanticWatchlist.settings.php   
2011-05-18 18:10:40 UTC (rev 88379)
+++ trunk/extensions/SemanticWatchlist/SemanticWatchlist.settings.php   
2011-05-18 18:45:39 UTC (rev 88380)
@@ -36,5 +36,8 @@
 # Enable email notification or not?
 $egSWLEnableEmailNotify = true;
 
-# The maximum amount of emails to send about changes untill the user actually 
checks his semantic watchlist.
+# Send an email for every change (as opossed to a "something changed email" 
for the first $egSWLMaxMails changes)?
+$egSWLMailPerChange = true;
+
+# The maximum amount of generic emails to send about changes untill the user 
actually checks his semantic watchlist.
 $egSWLMaxMails = 1;

Modified: trunk/extensions/SemanticWatchlist/includes/SWL_Emailer.php
===================================================================
--- trunk/extensions/SemanticWatchlist/includes/SWL_Emailer.php 2011-05-18 
18:10:40 UTC (rev 88379)
+++ trunk/extensions/SemanticWatchlist/includes/SWL_Emailer.php 2011-05-18 
18:45:39 UTC (rev 88380)
@@ -21,10 +21,11 @@
      * @param SWLGroup $group
      * @param User $user
      * @param SWLChangeSet $changeSet
+     * @param boolean $describeChanges
      * 
      * @return Status
      */
-    public static function notifyUser( SWLGroup $group, User $user, 
SWLChangeSet $changeSet ) {
+    public static function notifyUser( SWLGroup $group, User $user, 
SWLChangeSet $changeSet, $describeChanges ) {
        $emailText = wfMsgExt(
                'swl-email-propschanged-long',
                'parse', 
@@ -34,15 +35,17 @@
                $GLOBALS['wgLang']->timeanddate( $changeSet->getTime() )
        );
        
-       $emailText .= '<h3> ' . wfMsgExt(
-               'swl-email-changes',
-               'parse', 
-               $changeSet->getTitle()->getFullText(),
-               $changeSet->getTitle()->getFullURL()
-       ) . ' </h3>';
+       if ( $describeChanges ) {
+               $emailText .= '<h3> ' . wfMsgExt(
+                       'swl-email-changes',
+                       'parse', 
+                       $changeSet->getTitle()->getFullText(),
+                       $changeSet->getTitle()->getFullURL()
+               ) . ' </h3>';
+               
+               $emailText .= self::getChangeListHTML( $changeSet );            
        
+       }
        
-       $emailText .= self::getChangeListHTML( $changeSet );
-       
        //echo $emailText;exit;
        
        return $user->sendMail(


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

Reply via email to