[openstreetmap/openstreetmap-website] Add Messages API (PR #4605)

Tom Hughes notifications at github.com
Sun Jun 30 10:21:43 UTC 2024


@tomhughes commented on this pull request.



> @@ -0,0 +1,19 @@
+attrs = {
+  "id" => message.id,
+  "from_user_id" => message.from_user_id,
+  "to_user_id" => message.to_user_id,
+  "sent_on" => message.sent_on.xmlschema,
+  "body_format" => message.body_format
+}
+
+if current_user.id == message.from_user_id
+  attrs["from_user_visible"] = message.from_user_visible
+elsif current_user.id == message.to_user_id
+  attrs["message_read"] = message.message_read
+  attrs["to_user_visible"] = message.to_user_visible
+end

As before comments about the JSON version apply here as well.

> @@ -78,6 +78,15 @@
       end
     end
 
+    resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :destroy], :controller => "messages", :as => :api_messages do

If @gravitystorm thinks it is, on balance, the right choice then I think we can leave this as it is.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4605#pullrequestreview-2150020240
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4605/review/2150020240 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240630/fbbcc2e7/attachment.htm>


More information about the rails-dev mailing list