wiki pages: warn when renaming wikis still linked from other wikis.

* Warn when renaming a wiki that still has links from other wikis.
* When renaming a wiki that still has posts, just show a warning instead
  of returning an error and making the user confirm the rename.
This commit is contained in:
evazion
2019-12-16 18:32:48 -06:00
parent b038761fa7
commit be9bdc0ab3
4 changed files with 19 additions and 21 deletions

View File

@@ -164,14 +164,9 @@ class WikiPagesControllerTest < ActionDispatch::IntegrationTest
assert_equal("xyz", @wiki_page.body)
end
should "not rename a wiki page with a non-empty tag" do
put_auth wiki_page_path(@wiki_page), @user, params: {:wiki_page => {:title => "bar"}}
assert_equal("foo", @wiki_page.reload.title)
end
should "rename a wiki page with a non-empty tag if secondary validations are skipped" do
put_auth wiki_page_path(@wiki_page), @mod, params: {:wiki_page => {:title => "bar", :skip_secondary_validations => "1"}}
assert_equal("bar", @wiki_page.reload.title)
should "warn about renaming a wiki page with a non-empty tag" do
put_auth wiki_page_path(@wiki_page), @mod, params: { wiki_page: { title: "bar" }}
assert_match(/still has 42 posts/, flash[:notice])
end
should "not allow non-Builders to delete wiki pages" do