diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/chat.ex | 3 | ||||
| -rw-r--r-- | lib/pleroma/chat/message_reference.ex | 2 | 
2 files changed, 4 insertions, 1 deletions
| diff --git a/lib/pleroma/chat.ex b/lib/pleroma/chat.ex index 4fe31de94..24a86371e 100644 --- a/lib/pleroma/chat.ex +++ b/lib/pleroma/chat.ex @@ -16,6 +16,8 @@ defmodule Pleroma.Chat do    It is a helper only, to make it easy to display a list of chats with other people, ordered by last bump. The actual messages are retrieved by querying the recipients of the ChatMessages.    """ +  @primary_key {:id, FlakeId.Ecto.CompatType, autogenerate: true} +    schema "chats" do      belongs_to(:user, User, type: FlakeId.Ecto.CompatType)      field(:recipient, :string) @@ -63,6 +65,7 @@ defmodule Pleroma.Chat do      |> changeset(%{user_id: user_id, recipient: recipient})      |> Repo.insert(        on_conflict: [set: [updated_at: NaiveDateTime.utc_now()]], +      returning: true,        conflict_target: [:user_id, :recipient]      )    end diff --git a/lib/pleroma/chat/message_reference.ex b/lib/pleroma/chat/message_reference.ex index 4b201db2e..7ee7508ca 100644 --- a/lib/pleroma/chat/message_reference.ex +++ b/lib/pleroma/chat/message_reference.ex @@ -21,7 +21,7 @@ defmodule Pleroma.Chat.MessageReference do    schema "chat_message_references" do      belongs_to(:object, Object) -    belongs_to(:chat, Chat) +    belongs_to(:chat, Chat, type: FlakeId.Ecto.CompatType)      field(:unread, :boolean, default: true) | 
