remove requirement for note and content to have content

This commit is contained in:
shibao 2024-02-23 22:34:08 -05:00
parent 8666f663ba
commit d09f698b71
3 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# v0.1.15
- Sanitize titles while they are being typed
- Remove requirement for note and content to have content
- Prevent possible additional submissions
- Fix content being displayed when blank

View File

@ -57,7 +57,7 @@ defmodule Memex.Contexts.Context do
|> validate_format(:slug, ~r/^[\p{L}\p{N}\-]+$/,
message: dgettext("errors", "invalid format: only numbers, letters and hyphen are accepted")
)
|> validate_required([:slug, :content, :user_id, :visibility])
|> validate_required([:slug, :user_id, :visibility])
|> unique_constraint(:slug)
|> unsafe_validate_unique(:slug, Repo)
end
@ -70,7 +70,7 @@ defmodule Memex.Contexts.Context do
|> validate_format(:slug, ~r/^[\p{L}\p{N}\-]+$/,
message: dgettext("errors", "invalid format: only numbers, letters and hyphen are accepted")
)
|> validate_required([:slug, :content, :visibility])
|> validate_required([:slug, :visibility])
|> unique_constraint(:slug)
|> unsafe_validate_unique(:slug, Repo)
end

View File

@ -56,7 +56,7 @@ defmodule Memex.Notes.Note do
|> validate_format(:slug, ~r/^[\p{L}\p{N}\-]+$/,
message: dgettext("errors", "invalid format: only numbers, letters and hyphen are accepted")
)
|> validate_required([:slug, :content, :user_id, :visibility])
|> validate_required([:slug, :user_id, :visibility])
|> unique_constraint(:slug)
|> unsafe_validate_unique(:slug, Repo)
end
@ -69,7 +69,7 @@ defmodule Memex.Notes.Note do
|> validate_format(:slug, ~r/^[\p{L}\p{N}\-]+$/,
message: dgettext("errors", "invalid format: only numbers, letters and hyphen are accepted")
)
|> validate_required([:slug, :content, :visibility])
|> validate_required([:slug, :visibility])
|> unique_constraint(:slug)
|> unsafe_validate_unique(:slug, Repo)
end