Participations: Add marking as read and unread.
This commit is contained in:
parent
d1da6b155a
commit
64c1c3a407
3 changed files with 43 additions and 0 deletions
|
|
@ -19,4 +19,18 @@ defmodule Pleroma.Conversation.ParticipationTest do
|
|||
assert participation.user_id == user.id
|
||||
assert participation.conversation_id == conversation.id
|
||||
end
|
||||
|
||||
test "it marks a participation as read" do
|
||||
participation = insert(:participation, %{read: false})
|
||||
{:ok, participation} = Participation.mark_as_read(participation)
|
||||
|
||||
assert participation.read
|
||||
end
|
||||
|
||||
test "it marks a participation as unread" do
|
||||
participation = insert(:participation, %{read: true})
|
||||
{:ok, participation} = Participation.mark_as_unread(participation)
|
||||
|
||||
refute participation.read
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,6 +5,17 @@
|
|||
defmodule Pleroma.Factory do
|
||||
use ExMachina.Ecto, repo: Pleroma.Repo
|
||||
|
||||
def participation_factory do
|
||||
conversation = insert(:conversation)
|
||||
user = insert(:user)
|
||||
|
||||
%Pleroma.Conversation.Participation{
|
||||
conversation: conversation,
|
||||
user: user,
|
||||
read: false
|
||||
}
|
||||
end
|
||||
|
||||
def conversation_factory do
|
||||
%Pleroma.Conversation{
|
||||
ap_id: sequence(:ap_id, &"https://some_conversation/#{&1}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue