wikis: force wiki names to follow same rules as tag names.

Don't allow wiki pages to have invalid names.

This incidentally means that you can't create wiki pages for pools. For
example, you can't create a wiki titled "pool:almost_heart-warming".
This is not a valid tag name, so it's not a valid wiki name either. This
was done in a handful of cases to translate Pixiv tags to Danbooru pools
(see: <https://danbooru.donmai.us/wiki_page_versions?search[title_like]=pool:*>)

Also fix it so that titles are normalized before validation, not before save.
This commit is contained in:
evazion
2020-12-19 17:51:11 -06:00
parent 7708e2e08f
commit a129eb4251
3 changed files with 28 additions and 14 deletions

View File

@@ -109,13 +109,6 @@ class WikiPagesControllerTest < ActionDispatch::IntegrationTest
assert_response 404
end
should "render for a negated tag" do
as(@user) { @wiki_page.update(title: "-aaa") }
get wiki_page_path(@wiki_page.id)
assert_redirected_to wiki_page_path(@wiki_page.title)
end
should "work for a title containing dots" do
as(@user) { create(:wiki_page, title: "...") }