projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: Use NullCache for async tests.
[akkoma]
/
test
/
pleroma
/
conversation
/
participation_test.exs
diff --git
a/test/pleroma/conversation/participation_test.exs
b/test/pleroma/conversation/participation_test.exs
index 59a1b6492d75df3e0924e69a1c5183c1522686dc..5a603dcc1cdb18994cbcb81f1efb8a409c35030f 100644
(file)
--- a/
test/pleroma/conversation/participation_test.exs
+++ b/
test/pleroma/conversation/participation_test.exs
@@
-37,9
+37,8
@@
defmodule Pleroma.Conversation.ParticipationTest do
[%{read: true}] = Participation.for_user(user)
[%{read: false} = participation] = Participation.for_user(other_user)
[%{read: true}] = Participation.for_user(user)
[%{read: false} = participation] = Participation.for_user(other_user)
-
- assert User.get_cached_by_id(user.id).unread_conversation_count == 0
- assert User.get_cached_by_id(other_user.id).unread_conversation_count == 1
+ assert Participation.unread_count(user) == 0
+ assert Participation.unread_count(other_user) == 1
{:ok, _} =
CommonAPI.post(other_user, %{
{:ok, _} =
CommonAPI.post(other_user, %{
@@
-54,8
+53,8
@@
defmodule Pleroma.Conversation.ParticipationTest do
[%{read: false}] = Participation.for_user(user)
[%{read: true}] = Participation.for_user(other_user)
[%{read: false}] = Participation.for_user(user)
[%{read: true}] = Participation.for_user(other_user)
- assert
User.get_cached_by_id(user.id).unread_conversation_count
== 1
- assert
User.get_cached_by_id(other_user.id).unread_conversation_count
== 0
+ assert
Participation.unread_count(user)
== 1
+ assert
Participation.unread_count(other_user)
== 0
end
test "for a new conversation, it sets the recipents of the participation" do
end
test "for a new conversation, it sets the recipents of the participation" do
@@
-264,7
+263,7
@@
defmodule Pleroma.Conversation.ParticipationTest do
assert [%{read: false}, %{read: false}, %{read: false}, %{read: false}] =
Participation.for_user(blocker)
assert [%{read: false}, %{read: false}, %{read: false}, %{read: false}] =
Participation.for_user(blocker)
- assert
User.get_cached_by_id(blocker.id).unread_conversation_count
== 4
+ assert
Participation.unread_count(blocker)
== 4
{:ok, _user_relationship} = User.block(blocker, blocked)
{:ok, _user_relationship} = User.block(blocker, blocked)
@@
-272,15
+271,15
@@
defmodule Pleroma.Conversation.ParticipationTest do
assert [%{read: true}, %{read: true}, %{read: true}, %{read: false}] =
Participation.for_user(blocker)
assert [%{read: true}, %{read: true}, %{read: true}, %{read: false}] =
Participation.for_user(blocker)
- assert
User.get_cached_by_id(blocker.id).unread_conversation_count
== 1
+ assert
Participation.unread_count(blocker)
== 1
# The conversation is not marked as read for the blocked user
assert [_, _, %{read: false}] = Participation.for_user(blocked)
# The conversation is not marked as read for the blocked user
assert [_, _, %{read: false}] = Participation.for_user(blocked)
- assert
User.get_cached_by_id(blocked.id).unread_conversation_count
== 1
+ assert
Participation.unread_count(blocker)
== 1
# The conversation is not marked as read for the third user
assert [%{read: false}, _, _] = Participation.for_user(third_user)
# The conversation is not marked as read for the third user
assert [%{read: false}, _, _] = Participation.for_user(third_user)
- assert
User.get_cached_by_id(third_user.id).unread_conversation_count
== 1
+ assert
Participation.unread_count(third_user)
== 1
end
test "the new conversation with the blocked user is not marked as unread " do
end
test "the new conversation with the blocked user is not marked as unread " do
@@
-298,7
+297,7
@@
defmodule Pleroma.Conversation.ParticipationTest do
})
assert [%{read: true}] = Participation.for_user(blocker)
})
assert [%{read: true}] = Participation.for_user(blocker)
- assert
User.get_cached_by_id(blocker.id).unread_conversation_count
== 0
+ assert
Participation.unread_count(blocker)
== 0
# When the blocked user is a recipient
{:ok, _direct2} =
# When the blocked user is a recipient
{:ok, _direct2} =
@@
-308,10
+307,10
@@
defmodule Pleroma.Conversation.ParticipationTest do
})
assert [%{read: true}, %{read: true}] = Participation.for_user(blocker)
})
assert [%{read: true}, %{read: true}] = Participation.for_user(blocker)
- assert
User.get_cached_by_id(blocker.id).unread_conversation_count
== 0
+ assert
Participation.unread_count(blocker)
== 0
assert [%{read: false}, _] = Participation.for_user(blocked)
assert [%{read: false}, _] = Participation.for_user(blocked)
- assert
User.get_cached_by_id(blocked.id).unread_conversation_count
== 1
+ assert
Participation.unread_count(blocked)
== 1
end
test "the conversation with the blocked user is not marked as unread on a reply" do
end
test "the conversation with the blocked user is not marked as unread on a reply" do
@@
-327,8
+326,8
@@
defmodule Pleroma.Conversation.ParticipationTest do
{:ok, _user_relationship} = User.block(blocker, blocked)
assert [%{read: true}] = Participation.for_user(blocker)
{:ok, _user_relationship} = User.block(blocker, blocked)
assert [%{read: true}] = Participation.for_user(blocker)
- assert User.get_cached_by_id(blocker.id).unread_conversation_count == 0
+ assert Participation.unread_count(blocker) == 0
assert [blocked_participation] = Participation.for_user(blocked)
# When it's a reply from the blocked user
assert [blocked_participation] = Participation.for_user(blocked)
# When it's a reply from the blocked user
@@
-340,8
+339,8
@@
defmodule Pleroma.Conversation.ParticipationTest do
})
assert [%{read: true}] = Participation.for_user(blocker)
})
assert [%{read: true}] = Participation.for_user(blocker)
- assert User.get_cached_by_id(blocker.id).unread_conversation_count == 0
+ assert Participation.unread_count(blocker) == 0
assert [third_user_participation] = Participation.for_user(third_user)
# When it's a reply from the third user
assert [third_user_participation] = Participation.for_user(third_user)
# When it's a reply from the third user
@@
-353,11
+352,12
@@
defmodule Pleroma.Conversation.ParticipationTest do
})
assert [%{read: true}] = Participation.for_user(blocker)
})
assert [%{read: true}] = Participation.for_user(blocker)
- assert
User.get_cached_by_id(blocker.id).unread_conversation_count
== 0
+ assert
Participation.unread_count(blocker)
== 0
# Marked as unread for the blocked user
assert [%{read: false}] = Participation.for_user(blocked)
# Marked as unread for the blocked user
assert [%{read: false}] = Participation.for_user(blocked)
- assert User.get_cached_by_id(blocked.id).unread_conversation_count == 1
+
+ assert Participation.unread_count(blocked) == 1
end
end
end
end
end
end