diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 66056296e7..bbde5f9a27 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -62,7 +62,6 @@ class WikiPage < ActiveRecord::Base validate :validate_non_circular_dependency validate :validate_same_project - after_initialize :check_and_mark_as_protected before_save :update_redirects before_destroy :remove_redirects @@ -82,17 +81,8 @@ class WikiPage < ActiveRecord::Base .merge(Project.allowed_to(user, :view_wiki_pages)) } - # Wiki pages that are protected by default - DEFAULT_PROTECTED_PAGES = %w(sidebar) - after_destroy :delete_wiki_menu_item - def check_and_mark_as_protected - if new_record? && DEFAULT_PROTECTED_PAGES.include?(title.to_s.downcase) - self.protected = true - end - end - def slug read_attribute(:slug).presence || title.try(:to_url) end diff --git a/spec_legacy/unit/wiki_page_spec.rb b/spec_legacy/unit/wiki_page_spec.rb index 32610895ec..9da3e4594b 100644 --- a/spec_legacy/unit/wiki_page_spec.rb +++ b/spec_legacy/unit/wiki_page_spec.rb @@ -50,12 +50,6 @@ describe WikiPage, type: :model do assert @wiki.pages.include?(page) end - it 'should sidebar should be protected by default' do - page = @wiki.find_or_new_page('sidebar') - assert page.new_record? - assert page.protected? - end - it 'should find or new page' do page = @wiki.find_or_new_page('CookBook documentation') assert_kind_of WikiPage, page