]> git.openstreetmap.org Git - rails.git/blob - app/views/api/messages/_message.xml.builder
Merge pull request #5034 from grischard/patch-4
[rails.git] / app / views / api / messages / _message.xml.builder
1 attrs = {
2   "id" => message.id,
3   "from_user_id" => message.from_user_id,
4   "from_display_name" => message.sender.display_name,
5   "to_user_id" => message.to_user_id,
6   "to_display_name" => message.recipient.display_name,
7   "sent_on" => message.sent_on.xmlschema,
8   "body_format" => message.body_format
9 }
10
11 if current_user.id == message.from_user_id
12   attrs["deleted"] = !message.from_user_visible
13 elsif current_user.id == message.to_user_id
14   attrs["message_read"] = message.message_read
15   attrs["deleted"] = !message.to_user_visible
16 end
17
18 xml.message(attrs) do |nd|
19   nd.title(message.title)
20   nd.body(message.body) unless @skip_body
21 end