]> git.openstreetmap.org Git - rails.git/commitdiff
Add messages count to API response for logged in user details
authorSimon Poole <simon@poole.ch>
Fri, 16 Aug 2013 18:54:38 +0000 (20:54 +0200)
committerTom Hughes <tom@compton.nu>
Fri, 16 Aug 2013 20:09:04 +0000 (21:09 +0100)
Allows external editors to alert the user to the fact that they
have unread messages on the OSM site.

app/views/user/api_read.builder

index 71bf292081e0dd2f3dfdd01cdc04cce7c07b70ab..e976954206f08fe892c2405ecc492fdc7fdc22c8 100644 (file)
@@ -41,6 +41,11 @@ xml.osm("version" => API_VERSION, "generator" => GENERATOR) do
           @this_user.languages.split(",") { |lang| xml.tag! "lang", lang }
         end
       end
+      xml.tag! "messages" do
+        xml.tag! "received", :count => @this_user.messages.size,
+                             :unread => @this_user.new_messages.size
+        xml.tag! "sent", :count => @this_user.sent_messages.size
+      end
     end
   end
 end