summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/views
diff options
context:
space:
mode:
authorkaniini <ariadne@dereferenced.org>2019-10-05 19:28:07 +0000
committerkaniini <ariadne@dereferenced.org>2019-10-05 19:28:07 +0000
commit17ff4b43cb75334e6a6845a7d7ec9c88285a339d (patch)
tree44c9f86abc9d5eda51ccbe001c6f48779cf41cad /test/web/mastodon_api/views
parent0ee6100c8d7d21eb0c7cdd1c098a5071c0b9682f (diff)
parent8249924485965148f3a690c5d76e5f8b3bd78940 (diff)
downloadpleroma-17ff4b43cb75334e6a6845a7d7ec9c88285a339d.tar.gz
pleroma-17ff4b43cb75334e6a6845a7d7ec9c88285a339d.zip
Merge branch 'unread-conversation-count' into 'develop'
Add `pleroma.unread_conversation_count` to the Account entity See merge request pleroma/pleroma!1796
Diffstat (limited to 'test/web/mastodon_api/views')
-rw-r--r--test/web/mastodon_api/views/account_view_test.exs21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs
index 62b2ab7e3..b7a4938a6 100644
--- a/test/web/mastodon_api/views/account_view_test.exs
+++ b/test/web/mastodon_api/views/account_view_test.exs
@@ -418,6 +418,27 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
following_count: 1
} = AccountView.render("show.json", %{user: user, for: user})
end
+
+ test "shows unread_conversation_count only to the account owner" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, _activity} =
+ CommonAPI.post(user, %{
+ "status" => "Hey @#{other_user.nickname}.",
+ "visibility" => "direct"
+ })
+
+ user = User.get_cached_by_ap_id(user.ap_id)
+
+ assert AccountView.render("show.json", %{user: user, for: other_user})[:pleroma][
+ :unread_conversation_count
+ ] == nil
+
+ assert AccountView.render("show.json", %{user: user, for: user})[:pleroma][
+ :unread_conversation_count
+ ] == 1
+ end
end
describe "follow requests counter" do