From e6c7651d5d1435ec44c669d6a3149c796337d6c6 Mon Sep 17 00:00:00 2001 From: liamwhite Date: Sat, 1 Jun 2024 23:37:39 -0400 Subject: [PATCH] Fix MFA usage in cast_assoc (#267) --- lib/philomena/conversations/conversation.ex | 2 +- lib/philomena/topics/topic.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/philomena/conversations/conversation.ex b/lib/philomena/conversations/conversation.ex index 07e3f4ab6..ac188f1d3 100644 --- a/lib/philomena/conversations/conversation.ex +++ b/lib/philomena/conversations/conversation.ex @@ -57,7 +57,7 @@ defmodule Philomena.Conversations.Conversation do |> put_recipient() |> set_slug() |> 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) end diff --git a/lib/philomena/topics/topic.ex b/lib/philomena/topics/topic.ex index efc49ce47..0db301266 100644 --- a/lib/philomena/topics/topic.ex +++ b/lib/philomena/topics/topic.ex @@ -59,7 +59,7 @@ defmodule Philomena.Topics.Topic do |> change(forum: forum, user: attribution[:user]) |> validate_required(:forum) |> 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) |> unique_constraint(:slug, name: :index_topics_on_forum_id_and_slug) end