mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
more sophisticated map validation
This commit is contained in:
parent
acb50f3efe
commit
bd0711730e
1 changed files with 3 additions and 1 deletions
|
@ -60,7 +60,9 @@ defmodule PhilomenaWeb.ConversationController do
|
||||||
|
|
||||||
# Somewhat annoying, cast_assoc has no "limit" validation so we force it
|
# Somewhat annoying, cast_assoc has no "limit" validation so we force it
|
||||||
# here to require exactly 1
|
# here to require exactly 1
|
||||||
def create(conn, %{"conversation" => %{"messages" => %{"0" => _message_params}} = conversation_params}) do
|
def create(conn, %{"conversation" => %{"messages" => %{"0" => message_params} = messages_params} = conversation_params})
|
||||||
|
when %{"0" => message_params} == messages_params
|
||||||
|
do
|
||||||
user = conn.assigns.current_user
|
user = conn.assigns.current_user
|
||||||
|
|
||||||
case Conversations.create_conversation(user, conversation_params) do
|
case Conversations.create_conversation(user, conversation_params) do
|
||||||
|
|
Loading…
Reference in a new issue