Fix MFA usage in cast_assoc (#267)

This commit is contained in:
liamwhite 2024-06-01 23:37:39 -04:00 committed by GitHub
parent 80f9fa9352
commit e6c7651d5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -57,7 +57,7 @@ defmodule Philomena.Conversations.Conversation do
|> put_recipient() |> put_recipient()
|> set_slug() |> set_slug()
|> set_last_message() |> set_last_message()
|> cast_assoc(:messages, with: {Message, :creation_changeset, [from]}) |> cast_assoc(:messages, with: &Message.creation_changeset(&1, &2, from))
|> validate_length(:messages, is: 1) |> validate_length(:messages, is: 1)
end end

View file

@ -59,7 +59,7 @@ defmodule Philomena.Topics.Topic do
|> change(forum: forum, user: attribution[:user]) |> change(forum: forum, user: attribution[:user])
|> validate_required(:forum) |> validate_required(:forum)
|> cast_assoc(:poll, with: &Poll.update_changeset/2) |> cast_assoc(:poll, with: &Poll.update_changeset/2)
|> cast_assoc(:posts, with: {Post, :topic_creation_changeset, [attribution, anonymous?]}) |> cast_assoc(:posts, with: &Post.topic_creation_changeset(&1, &2, attribution, anonymous?))
|> validate_length(:posts, is: 1) |> validate_length(:posts, is: 1)
|> unique_constraint(:slug, name: :index_topics_on_forum_id_and_slug) |> unique_constraint(:slug, name: :index_topics_on_forum_id_and_slug)
end end