projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into issue/2099
[akkoma]
/
test
/
web
/
pleroma_api
/
views
/
chat_view_test.exs
diff --git
a/test/web/pleroma_api/views/chat_view_test.exs
b/test/web/pleroma_api/views/chat_view_test.exs
index e24e298351fb3c6205ccc530787b65327443ea5f..02484b705b7ccd380fd60d41d1eb5b5ea2602ba1 100644
(file)
--- a/
test/web/pleroma_api/views/chat_view_test.exs
+++ b/
test/web/pleroma_api/views/chat_view_test.exs
@@
-6,10
+6,12
@@
defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
use Pleroma.DataCase
alias Pleroma.Chat
use Pleroma.DataCase
alias Pleroma.Chat
+ alias Pleroma.Chat.MessageReference
alias Pleroma.Object
alias Pleroma.Web.CommonAPI
alias Pleroma.Object
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.MastodonAPI.AccountView
- alias Pleroma.Web.PleromaAPI.Chat
Messag
eView
+ alias Pleroma.Web.PleromaAPI.Chat
.MessageReferenc
eView
alias Pleroma.Web.PleromaAPI.ChatView
import Pleroma.Factory
alias Pleroma.Web.PleromaAPI.ChatView
import Pleroma.Factory
@@
-24,9
+26,11
@@
defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
assert represented_chat == %{
id: "#{chat.id}",
assert represented_chat == %{
id: "#{chat.id}",
- account: AccountView.render("show.json", user: recipient),
+ account:
+ AccountView.render("show.json", user: recipient, skip_visibility_check: true),
unread: 0,
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")
}
{:ok, chat_message_creation} = CommonAPI.post_chat_message(user, recipient, "hello")
@@
-37,7
+41,9
@@
defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
represented_chat = ChatView.render("show.json", chat: chat)
represented_chat = ChatView.render("show.json", chat: chat)
+ cm_ref = MessageReference.for_chat_and_object(chat, chat_message)
+
assert represented_chat[:last_message] ==
assert represented_chat[:last_message] ==
-
ChatMessageView.render("show.json", chat: chat, object: chat_message
)
+
MessageReferenceView.render("show.json", chat_message_reference: cm_ref
)
end
end
end
end