remove unread_conversation_count from User
This commit is contained in:
parent
e0eb90f62a
commit
0d5088c2b8
9 changed files with 92 additions and 94 deletions
|
|
@ -5,6 +5,7 @@
|
|||
defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
alias Pleroma.Conversation.Participation
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.CommonAPI
|
||||
|
||||
|
|
@ -28,10 +29,10 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
user_three: user_three,
|
||||
conn: conn
|
||||
} do
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 0
|
||||
assert Participation.unread_count(user_two) == 0
|
||||
{:ok, direct} = create_direct_message(user_one, [user_two, user_three])
|
||||
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 1
|
||||
assert Participation.unread_count(user_two) == 1
|
||||
|
||||
{:ok, _follower_only} =
|
||||
CommonAPI.post(user_one, %{
|
||||
|
|
@ -59,7 +60,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
assert is_binary(res_id)
|
||||
assert unread == false
|
||||
assert res_last_status["id"] == direct.id
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 0
|
||||
assert Participation.unread_count(user_one) == 0
|
||||
end
|
||||
|
||||
test "observes limit params", %{
|
||||
|
|
@ -134,8 +135,8 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
user_two = insert(:user)
|
||||
{:ok, direct} = create_direct_message(user_one, [user_two])
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 0
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 1
|
||||
assert Participation.unread_count(user_one) == 0
|
||||
assert Participation.unread_count(user_two) == 1
|
||||
|
||||
user_two_conn =
|
||||
build_conn()
|
||||
|
|
@ -155,8 +156,8 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
|> post("/api/v1/conversations/#{direct_conversation_id}/read")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 0
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 0
|
||||
assert Participation.unread_count(user_one) == 0
|
||||
assert Participation.unread_count(user_two) == 0
|
||||
|
||||
# The conversation is marked as unread on reply
|
||||
{:ok, _} =
|
||||
|
|
@ -171,8 +172,8 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
|> get("/api/v1/conversations")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 1
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 0
|
||||
assert Participation.unread_count(user_one) == 1
|
||||
assert Participation.unread_count(user_two) == 0
|
||||
|
||||
# A reply doesn't increment the user's unread_conversation_count if the conversation is unread
|
||||
{:ok, _} =
|
||||
|
|
@ -182,8 +183,8 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
in_reply_to_status_id: direct.id
|
||||
})
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 1
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 0
|
||||
assert Participation.unread_count(user_one) == 1
|
||||
assert Participation.unread_count(user_two) == 0
|
||||
end
|
||||
|
||||
test "(vanilla) Mastodon frontend behaviour", %{user: user_one, conn: conn} do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue