]> git.openstreetmap.org Git - rails.git/blob - app/views/api/messages/_message.xml.builder
Merge remote-tracking branch 'upstream/pull/5533'
[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 attrs["message_read"] = message.message_read if current_user.id == message.to_user_id
12
13 if current_user.id == message.from_user_id
14   attrs["deleted"] = !message.from_user_visible
15 elsif current_user.id == message.to_user_id
16   attrs["deleted"] = !message.to_user_visible
17 end
18
19 xml.message(attrs) do |nd|
20   nd.title(message.title)
21   nd.body(message.body) unless @skip_body
22 end