Mastodon API: Mark the conversation as read for the author when they send a new direct message

This commit is contained in:
eugenijm 2019-10-17 15:25:15 +03:00
commit 359dd1890e
7 changed files with 91 additions and 13 deletions

View file

@ -48,6 +48,12 @@ defmodule Pleroma.Conversation.Participation do
|> validate_required([:read])
end
def mark_as_read(%User{} = user, %Conversation{} = conversation) do
with %__MODULE__{} = participation <- for_user_and_conversation(user, conversation) do
mark_as_read(participation)
end
end
def mark_as_read(participation) do
participation
|> read_cng(%{read: true})