added unread_notifications_count for /api/v1/accounts/verify_credentials

This commit is contained in:
Maksim Pechnikov 2020-05-06 15:08:38 +03:00
commit bd261309cc
5 changed files with 55 additions and 4 deletions

View file

@ -466,6 +466,24 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
:unread_conversation_count
] == 1
end
test "shows unread_count only to the account owner" do
user = insert(:user)
insert_list(7, :notification, user: user)
other_user = insert(:user)
user = User.get_cached_by_ap_id(user.ap_id)
assert AccountView.render(
"show.json",
%{user: user, for: other_user}
)[:pleroma][:unread_notifications_count] == nil
assert AccountView.render(
"show.json",
%{user: user, for: user}
)[:pleroma][:unread_notifications_count] == 7
end
end
describe "follow requests counter" do