mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-23 00:14:48 +00:00
Set an event UUID if default is nil
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
aaf9c2c931
commit
afff01d6d2
1 changed files with 1 additions and 1 deletions
|
@ -133,7 +133,7 @@ defmodule Mobilizon.Events.Event do
|
|||
@doc false
|
||||
@spec changeset(t | Ecto.Schema.t(), map) :: Changeset.t()
|
||||
def changeset(%__MODULE__{} = event, attrs) do
|
||||
attrs = Map.update(attrs, :uuid, Ecto.UUID.generate(), & &1)
|
||||
attrs = Map.update(attrs, :uuid, Ecto.UUID.generate(), &(&1 || Ecto.UUID.generate()))
|
||||
attrs = Map.update(attrs, :url, Routes.page_url(Endpoint, :event, attrs.uuid), & &1)
|
||||
|
||||
event
|
||||
|
|
Loading…
Reference in a new issue