dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15656
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5729: Messages, minor fix for read function
------------------------------------------------------------
revno: 5729
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-01-13 19:59:01 +0100
message:
Messages, minor fix for read function
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/ReadMessageAction.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/MessageConversation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java 2012-01-11 15:58:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java 2012-01-13 18:59:01 +0000
@@ -91,30 +91,38 @@
this.messages.add( message );
}
- public void markRead( User user )
+ public boolean markRead( User user )
{
for ( UserMessage userMessage : userMessages )
{
if ( userMessage.getUser() != null && userMessage.getUser().equals( user ) )
{
+ boolean read = userMessage.isRead();
+
userMessage.setRead( true );
- return;
+ return !read;
}
}
+
+ return false;
}
- public void markUnread( User user )
+ public boolean markUnread( User user )
{
for ( UserMessage userMessage : userMessages )
{
if ( userMessage.getUser() != null && userMessage.getUser().equals( user ) )
{
+ boolean read = userMessage.isRead();
+
userMessage.setRead( false );
- return;
+ return read;
}
}
+
+ return false;
}
public void markReplied( User sender, Message message )
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/ReadMessageAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/ReadMessageAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/ReadMessageAction.java 2012-01-13 18:59:01 +0000
@@ -89,9 +89,10 @@
{
conversation = messageService.getMessageConversation( id );
- conversation.markRead( currentUserService.getCurrentUser() );
-
- messageService.updateMessageConversation( conversation );
+ if ( conversation.markRead( currentUserService.getCurrentUser() ) )
+ {
+ messageService.updateMessageConversation( conversation );
+ }
return SUCCESS;
}