← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15194: Attempted fix for email message sender not sending emails

 

------------------------------------------------------------
revno: 15194
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-05-08 09:37:31 +0200
message:
  Attempted fix for email message sender not sending emails
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java	2014-05-08 07:37:31 +0000
@@ -30,8 +30,6 @@
 
 import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION;
 
-import java.io.Serializable;
-import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
@@ -104,8 +102,6 @@
             ( sender.getEmail() != null ? ( sender.getEmail() + LB ) : StringUtils.EMPTY ) +
             ( sender.getPhoneNumber() != null ? ( sender.getPhoneNumber() + LB ) : StringUtils.EMPTY ) );
         
-        Map<User, Serializable> settings = userService.getUserSettings( KEY_MESSAGE_EMAIL_NOTIFICATION, false );
-
         try
         {
             Email email = getEmail( hostName, port, username, password, tls );
@@ -116,7 +112,7 @@
             
             for ( User user : users )
             {
-                boolean emailNotification = settings.get( user ) != null && (Boolean) settings.get( user ) == true;
+                boolean emailNotification = (Boolean) userService.getUserSettingValue( user, KEY_MESSAGE_EMAIL_NOTIFICATION, false );
                 
                 boolean doSend = forceSend || emailNotification;
     
@@ -124,7 +120,7 @@
                 {
                     email.addBcc( user.getEmail() );
                     
-                    log.info( "Sending email to user: " + user + " with email address: " + user.getEmail() );
+                    log.info( "Sending email to user: " + user.getUsername() + " with email address: " + user.getEmail() );
                     
                     hasRecipients = true;
                 }