Credo fixes.

This commit is contained in:
lain 2020-06-05 12:45:25 +02:00
parent 0efa8aa0b9
commit f3ea6ee2c8
2 changed files with 3 additions and 2 deletions

View File

@ -142,7 +142,8 @@ def handle_object_creation(%{"type" => "ChatMessage"} = object, meta) do
{:ok, chat} = Chat.bump_or_create(user.id, other_user.ap_id) {:ok, chat} = Chat.bump_or_create(user.id, other_user.ap_id)
{:ok, cm_ref} = ChatMessageReference.create(chat, object, user.ap_id != actor.ap_id) {:ok, cm_ref} = ChatMessageReference.create(chat, object, user.ap_id != actor.ap_id)
# We add a cache of the unread value here so that it doesn't change when being streamed out # We add a cache of the unread value here so that it
# doesn't change when being streamed out
chat = chat =
chat chat
|> Map.put(:unread, ChatMessageReference.unread_count_for_chat(chat)) |> Map.put(:unread, ChatMessageReference.unread_count_for_chat(chat))

View File

@ -55,7 +55,7 @@ def render("chat_update.json", %{chat_message_reference: cm_ref}) do
# Explicitly giving the cmr for the object here, so we don't accidentally # Explicitly giving the cmr for the object here, so we don't accidentally
# send a later 'last_message' that was inserted between inserting this and # send a later 'last_message' that was inserted between inserting this and
# streaming it out # streaming it out
# #
# It also contains the chat with a cache of the correct unread count # It also contains the chat with a cache of the correct unread count
Logger.debug("Trying to stream out #{inspect(cm_ref)}") Logger.debug("Trying to stream out #{inspect(cm_ref)}")