← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8927: Messaging, not including feedback recipients when sending messages between users

 

------------------------------------------------------------
revno: 8927
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-07 12:08:56 +0300
message:
  Messaging, not including feedback recipients when sending messages between users
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.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-api/src/main/java/org/hisp/dhis/message/MessageService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java	2012-05-30 08:41:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java	2012-11-07 09:08:56 +0000
@@ -44,6 +44,8 @@
     
     int sendMessage( String subject, String text, String metaData, Set<User> users );
     
+    int sendMessage( String subject, String text, String metaData, Set<User> users, boolean includeFeedbackRecipients );
+    
     int sendFeedback( String subject, String text, String metaData );
     
     void sendReply( MessageConversation conversation, String text, String metaData );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2012-09-24 21:54:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2012-11-07 09:08:56 +0000
@@ -96,17 +96,27 @@
 
     public int sendMessage( String subject, String text, String metaData, Set<User> users )
     {
+        return sendMessage( subject, text, metaData, users, false );
+    }
+    
+    public int sendMessage( String subject, String text, String metaData, Set<User> users_, boolean includeFeedbackRecipients )
+    {
+        Set<User> users = new HashSet<User>( users_ );
+        
         // ---------------------------------------------------------------------
         // Add feedback recipients to users if they are not there
         // ---------------------------------------------------------------------
 
-        UserGroup userGroup = configurationService.getConfiguration().getFeedbackRecipients();
-
-        if ( userGroup != null && userGroup.getMembers().size() > 0 )
+        if ( includeFeedbackRecipients )
         {
-            users.addAll( userGroup.getMembers() );
+            UserGroup userGroup = configurationService.getConfiguration().getFeedbackRecipients();
+    
+            if ( userGroup != null && userGroup.getMembers().size() > 0 )
+            {
+                users.addAll( userGroup.getMembers() );
+            }
         }
-
+        
         User sender = currentUserService.getCurrentUser();
 
         if ( sender != null )
@@ -138,7 +148,7 @@
 
     public int sendFeedback( String subject, String text, String metaData )
     {
-        return sendMessage( subject, text, metaData, new HashSet<User>() );
+        return sendMessage( subject, text, metaData, new HashSet<User>(), true );
     }
 
     public void sendReply( MessageConversation conversation, String text, String metaData )