← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16897: Fixed wrong path in ajax call breaking messaging api calls + minor fixes

 

------------------------------------------------------------
revno: 16897
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-01 11:58:24 +0200
message:
  Fixed wrong path in ajax call breaking messaging api calls + minor fixes
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js


--
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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java	2014-10-01 08:39:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java	2014-10-01 09:58:24 +0000
@@ -274,14 +274,14 @@
     // Mark conversations read
     //--------------------------------------------------------------------------
 
-    @RequestMapping( value = "/read", method = RequestMethod.PUT, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } )
+    @RequestMapping( value = "/read", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } )
     public @ResponseBody RootNode markMessageConversationsRead(
         @RequestParam( value = "user", required = false ) String userUid, @RequestBody String[] uids, HttpServletResponse response )
     {
         RootNode responseNode = new RootNode( "response" );
 
         User currentUser = currentUserService.getCurrentUser();
-        User user = userUid != null ? userService.getUser( userUid ) : currentUserService.getCurrentUser();
+        User user = userUid != null ? userService.getUser( userUid ) : currentUser;
 
         if( user == null )
         {
@@ -325,7 +325,7 @@
     // Mark conversations unread
     //--------------------------------------------------------------------------
 
-    @RequestMapping( value = "/unread", method = RequestMethod.PUT, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } )
+    @RequestMapping( value = "/unread", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } )
     public @ResponseBody RootNode markMessageConversationsUnread(
         @RequestParam( value = "user", required = false ) String userUid, @RequestBody String[] uids, HttpServletResponse response )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js	2014-09-22 13:49:28 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js	2014-10-01 09:58:24 +0000
@@ -24,7 +24,7 @@
 
         $.ajax(
         {
-            url: "../../api/messageConversations?" + $.param( { mc: messages }, true ),
+            url: "../api/messageConversations?" + $.param( { mc: messages }, true ),
             contentType: "application/json",
             dataType: "json",
             type: "DELETE",
@@ -53,8 +53,8 @@
 
     $.ajax(
     {
-        url: "../../api/messageConversations/read",
-        type: "PUT",
+        url: "../api/messageConversations/read",
+        type: "POST",
         data: JSON.stringify( messages ),
         contentType: "application/json",
         dataType: "json",
@@ -78,8 +78,8 @@
 
     $.ajax(
     {
-        url: "../../api/messageConversations/unread",
-        type: "PUT",
+        url: "../api/messageConversations/unread",
+        type: "POST",
         data: JSON.stringify( messages ),
         contentType: "application/json",
         dataType: "json",