From ef6b3e0271d226462bed5f899f3964cf5652978c Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 26 Mar 2018 17:16:01 +0800 Subject: Introduce #find_sidebar and use a constant to find the page --- app/models/project_wiki.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/models') diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 52e067cb44c..e70b7dc2325 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectWiki include Gitlab::ShellAdapter include Storage::LegacyProjectWiki @@ -9,6 +11,7 @@ class ProjectWiki }.freeze unless defined?(MARKUPS) CouldNotCreateWikiError = Class.new(StandardError) + SIDEBAR = '_sidebar' # Returns a string describing what went wrong after # an operation fails. @@ -95,6 +98,10 @@ class ProjectWiki end end + def find_sidebar(version = nil) + find_page(SIDEBAR, version) + end + def find_file(name, version = nil) wiki.file(name, version) end -- cgit v1.2.1