From 625ed5a594f04290e5a8099b05562ad2aae3714f Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 26 Dec 2019 10:16:37 -0500 Subject: [PATCH] fix conversation read marking --- lib/philomena/conversations.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/philomena/conversations.ex b/lib/philomena/conversations.ex index 1dbaf20e..a9d41269 100644 --- a/lib/philomena/conversations.ex +++ b/lib/philomena/conversations.ex @@ -108,6 +108,11 @@ defmodule Philomena.Conversations do 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 conversation |> Conversation.read_changeset(%{to_read: read})