aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-05-14 13:20:28 +0200
committerlain <lain@soykaf.club>2020-05-14 13:20:28 +0200
commit3342846ac2bbd48e985cfeff26ba4593f4815879 (patch)
treeb24f38ad7d4b7bdf3cb216fec7573b3a41166420
parent0f0acc740d30c47d093f27875d4decf0693b2845 (diff)
downloadpleroma-3342846ac2bbd48e985cfeff26ba4593f4815879.tar.gz
ChatView: Add update_at field.
-rw-r--r--lib/pleroma/web/pleroma_api/views/chat_view.ex4
-rw-r--r--test/web/pleroma_api/views/chat_view_test.exs4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/pleroma/web/pleroma_api/views/chat_view.ex b/lib/pleroma/web/pleroma_api/views/chat_view.ex
index 21f0612ff..08d5110c3 100644
--- a/lib/pleroma/web/pleroma_api/views/chat_view.ex
+++ b/lib/pleroma/web/pleroma_api/views/chat_view.ex
@@ -7,6 +7,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatView do
alias Pleroma.Chat
alias Pleroma.User
+ alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.PleromaAPI.ChatMessageView
@@ -20,7 +21,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatView do
account: AccountView.render("show.json", Map.put(opts, :user, recipient)),
unread: chat.unread,
last_message:
- last_message && ChatMessageView.render("show.json", chat: chat, object: last_message)
+ last_message && ChatMessageView.render("show.json", chat: chat, object: last_message),
+ updated_at: Utils.to_masto_date(chat.updated_at)
}
end
diff --git a/test/web/pleroma_api/views/chat_view_test.exs b/test/web/pleroma_api/views/chat_view_test.exs
index e24e29835..6062a0cfe 100644
--- a/test/web/pleroma_api/views/chat_view_test.exs
+++ b/test/web/pleroma_api/views/chat_view_test.exs
@@ -8,6 +8,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
alias Pleroma.Chat
alias Pleroma.Object
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.PleromaAPI.ChatMessageView
alias Pleroma.Web.PleromaAPI.ChatView
@@ -26,7 +27,8 @@ defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
id: "#{chat.id}",
account: AccountView.render("show.json", user: recipient),
unread: 0,
- last_message: nil
+ last_message: nil,
+ updated_at: Utils.to_masto_date(chat.updated_at)
}
{:ok, chat_message_creation} = CommonAPI.post_chat_message(user, recipient, "hello")