tolerate spaces in tags
This commit is contained in:
parent
1d6ba5960c
commit
d5e334dc09
@ -1,6 +1,7 @@
|
|||||||
# v0.1.13
|
# v0.1.13
|
||||||
- Update dependencies
|
- Update dependencies
|
||||||
- Fix debounces
|
- Fix debounces
|
||||||
|
- Allow space as delimiter for tags
|
||||||
|
|
||||||
# v0.1.12
|
# v0.1.12
|
||||||
- Code quality fixes
|
- Code quality fixes
|
||||||
|
@ -83,7 +83,7 @@ defmodule Memex.Contexts.Context do
|
|||||||
message:
|
message:
|
||||||
dgettext(
|
dgettext(
|
||||||
"errors",
|
"errors",
|
||||||
"invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
"invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|> cast_tags()
|
|> cast_tags()
|
||||||
@ -98,9 +98,9 @@ defmodule Memex.Contexts.Context do
|
|||||||
|
|
||||||
defp process_tags(tags_string) when tags_string |> is_binary() do
|
defp process_tags(tags_string) when tags_string |> is_binary() do
|
||||||
tags_string
|
tags_string
|
||||||
|> String.split(",", trim: true)
|
|> String.split([",", " "], trim: true)
|
||||||
|> Enum.map(fn str -> str |> String.trim() end)
|
|> Enum.map(fn str -> str |> String.trim() end)
|
||||||
|> Enum.reject(fn str -> str |> is_nil() end)
|
|> Enum.reject(fn str -> str in [nil, ""] end)
|
||||||
|> Enum.sort()
|
|> Enum.sort()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ defmodule Memex.Notes.Note do
|
|||||||
message:
|
message:
|
||||||
dgettext(
|
dgettext(
|
||||||
"errors",
|
"errors",
|
||||||
"invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
"invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|> cast_tags()
|
|> cast_tags()
|
||||||
@ -97,9 +97,9 @@ defmodule Memex.Notes.Note do
|
|||||||
|
|
||||||
defp process_tags(tags_string) when tags_string |> is_binary() do
|
defp process_tags(tags_string) when tags_string |> is_binary() do
|
||||||
tags_string
|
tags_string
|
||||||
|> String.split(",", trim: true)
|
|> String.split([",", " "], trim: true)
|
||||||
|> Enum.map(fn str -> str |> String.trim() end)
|
|> Enum.map(fn str -> str |> String.trim() end)
|
||||||
|> Enum.reject(fn str -> str |> is_nil() end)
|
|> Enum.reject(fn str -> str in [nil, ""] end)
|
||||||
|> Enum.sort()
|
|> Enum.sort()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ defmodule Memex.Pipelines.Pipeline do
|
|||||||
message:
|
message:
|
||||||
dgettext(
|
dgettext(
|
||||||
"errors",
|
"errors",
|
||||||
"invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
"invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|> cast_tags()
|
|> cast_tags()
|
||||||
@ -100,9 +100,9 @@ defmodule Memex.Pipelines.Pipeline do
|
|||||||
|
|
||||||
defp process_tags(tags_string) when tags_string |> is_binary() do
|
defp process_tags(tags_string) when tags_string |> is_binary() do
|
||||||
tags_string
|
tags_string
|
||||||
|> String.split(",", trim: true)
|
|> String.split([",", " "], trim: true)
|
||||||
|> Enum.map(fn str -> str |> String.trim() end)
|
|> Enum.map(fn str -> str |> String.trim() end)
|
||||||
|> Enum.reject(fn str -> str |> is_nil() end)
|
|> Enum.reject(fn str -> str in [nil, ""] end)
|
||||||
|> Enum.sort()
|
|> Enum.sort()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -79,13 +79,6 @@ msgstr ""
|
|||||||
msgid "unauthorized"
|
msgid "unauthorized"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/contexts/context.ex:84
|
|
||||||
#: lib/memex/notes/note.ex:83
|
|
||||||
#: lib/memex/pipelines/pipeline.ex:86
|
|
||||||
#, elixir-autogen, elixir-format, fuzzy
|
|
||||||
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_html/new.html.heex:13
|
#: lib/memex_web/controllers/user_registration_html/new.html.heex:13
|
||||||
#: lib/memex_web/controllers/user_reset_password_html/edit.html.heex:13
|
#: lib/memex_web/controllers/user_reset_password_html/edit.html.heex:13
|
||||||
#: lib/memex_web/controllers/user_settings_html/edit.html.heex:64
|
#: lib/memex_web/controllers/user_settings_html/edit.html.heex:64
|
||||||
@ -146,3 +139,10 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
msgid "user confirmation link is invalid or it has expired."
|
msgid "user confirmation link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex/contexts/context.ex:84
|
||||||
|
#: lib/memex/notes/note.ex:83
|
||||||
|
#: lib/memex/pipelines/pipeline.ex:86
|
||||||
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
|
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited"
|
||||||
|
msgstr ""
|
||||||
|
@ -80,13 +80,6 @@ msgstr ""
|
|||||||
msgid "unauthorized"
|
msgid "unauthorized"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/contexts/context.ex:84
|
|
||||||
#: lib/memex/notes/note.ex:83
|
|
||||||
#: lib/memex/pipelines/pipeline.ex:86
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_html/new.html.heex:13
|
#: lib/memex_web/controllers/user_registration_html/new.html.heex:13
|
||||||
#: lib/memex_web/controllers/user_reset_password_html/edit.html.heex:13
|
#: lib/memex_web/controllers/user_reset_password_html/edit.html.heex:13
|
||||||
#: lib/memex_web/controllers/user_settings_html/edit.html.heex:64
|
#: lib/memex_web/controllers/user_settings_html/edit.html.heex:64
|
||||||
@ -147,3 +140,10 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format, fuzzy
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
msgid "user confirmation link is invalid or it has expired."
|
msgid "user confirmation link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex/contexts/context.ex:84
|
||||||
|
#: lib/memex/notes/note.ex:83
|
||||||
|
#: lib/memex/pipelines/pipeline.ex:86
|
||||||
|
#, elixir-autogen, elixir-format, fuzzy
|
||||||
|
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited"
|
||||||
|
msgstr ""
|
||||||
|
@ -79,13 +79,6 @@ msgstr ""
|
|||||||
msgid "unauthorized"
|
msgid "unauthorized"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/memex/contexts/context.ex:84
|
|
||||||
#: lib/memex/notes/note.ex:83
|
|
||||||
#: lib/memex/pipelines/pipeline.ex:86
|
|
||||||
#, elixir-autogen, elixir-format
|
|
||||||
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma-delimited"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: lib/memex_web/controllers/user_registration_html/new.html.heex:13
|
#: lib/memex_web/controllers/user_registration_html/new.html.heex:13
|
||||||
#: lib/memex_web/controllers/user_reset_password_html/edit.html.heex:13
|
#: lib/memex_web/controllers/user_reset_password_html/edit.html.heex:13
|
||||||
#: lib/memex_web/controllers/user_settings_html/edit.html.heex:64
|
#: lib/memex_web/controllers/user_settings_html/edit.html.heex:64
|
||||||
@ -146,3 +139,10 @@ msgstr ""
|
|||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "user confirmation link is invalid or it has expired."
|
msgid "user confirmation link is invalid or it has expired."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/memex/contexts/context.ex:84
|
||||||
|
#: lib/memex/notes/note.ex:83
|
||||||
|
#: lib/memex/pipelines/pipeline.ex:86
|
||||||
|
#, elixir-autogen, elixir-format
|
||||||
|
msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited"
|
||||||
|
msgstr ""
|
||||||
|
@ -17,7 +17,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
}
|
}
|
||||||
@invalid_attrs %{
|
@invalid_attrs %{
|
||||||
content: nil,
|
content: nil,
|
||||||
tags_string: "invalid tags",
|
tags_string: "invalid_tag or_tags",
|
||||||
slug: nil,
|
slug: nil,
|
||||||
visibility: nil
|
visibility: nil
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ defmodule MemexWeb.ContextLiveTest do
|
|||||||
|> render_change(context: @invalid_attrs)
|
|> render_change(context: @invalid_attrs)
|
||||||
|
|
||||||
assert html =~ "can't be blank"
|
assert html =~ "can't be blank"
|
||||||
assert html =~ "tags must be comma-delimited"
|
assert html =~ "tags must be comma or space delimited"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _live, html} =
|
||||||
show_live
|
show_live
|
||||||
|
@ -17,7 +17,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
}
|
}
|
||||||
@invalid_attrs %{
|
@invalid_attrs %{
|
||||||
content: nil,
|
content: nil,
|
||||||
tags_string: "invalid tags",
|
tags_string: "invalid_tag or_tags",
|
||||||
slug: nil,
|
slug: nil,
|
||||||
visibility: nil
|
visibility: nil
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ defmodule MemexWeb.NoteLiveTest do
|
|||||||
|> render_change(note: @invalid_attrs)
|
|> render_change(note: @invalid_attrs)
|
||||||
|
|
||||||
assert html =~ "can't be blank"
|
assert html =~ "can't be blank"
|
||||||
assert html =~ "tags must be comma-delimited"
|
assert html =~ "tags must be comma or space delimited"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _live, html} =
|
||||||
index_live
|
index_live
|
||||||
|
@ -17,7 +17,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
}
|
}
|
||||||
@invalid_attrs %{
|
@invalid_attrs %{
|
||||||
description: nil,
|
description: nil,
|
||||||
tags_string: "invalid tags",
|
tags_string: "invalid_tag or_tags",
|
||||||
slug: nil,
|
slug: nil,
|
||||||
visibility: nil
|
visibility: nil
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ defmodule MemexWeb.PipelineLiveTest do
|
|||||||
|> render_change(pipeline: @invalid_attrs)
|
|> render_change(pipeline: @invalid_attrs)
|
||||||
|
|
||||||
assert html =~ "can't be blank"
|
assert html =~ "can't be blank"
|
||||||
assert html =~ "tags must be comma-delimited"
|
assert html =~ "tags must be comma or space delimited"
|
||||||
|
|
||||||
{:ok, _live, html} =
|
{:ok, _live, html} =
|
||||||
show_live
|
show_live
|
||||||
|
Loading…
Reference in New Issue
Block a user