mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
fix conversation read marking
This commit is contained in:
parent
a1a1eaeb77
commit
625ed5a594
1 changed files with 5 additions and 0 deletions
|
@ -108,6 +108,11 @@ defmodule Philomena.Conversations do
|
||||||
|
|
||||||
def mark_conversation_read(conversation, user, read \\ true)
|
def mark_conversation_read(conversation, user, read \\ true)
|
||||||
|
|
||||||
|
def mark_conversation_read(%Conversation{to_id: user_id, from_id: user_id} = conversation, %{id: user_id}, read) do
|
||||||
|
conversation
|
||||||
|
|> Conversation.read_changeset(%{to_read: read, from_read: read})
|
||||||
|
|> Repo.update()
|
||||||
|
end
|
||||||
def mark_conversation_read(%Conversation{to_id: user_id} = conversation, %{id: user_id}, read) do
|
def mark_conversation_read(%Conversation{to_id: user_id} = conversation, %{id: user_id}, read) do
|
||||||
conversation
|
conversation
|
||||||
|> Conversation.read_changeset(%{to_read: read})
|
|> Conversation.read_changeset(%{to_read: read})
|
||||||
|
|
Loading…
Reference in a new issue