diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-31 21:06:28 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-31 21:06:28 +0000 |
commit | 8f210aebe1d740e8ee194f171f1f33a6e1fba313 (patch) | |
tree | f43c545801bb96fd0737f18493fb30ab92972627 /app/models/project_wiki.rb | |
parent | 996f700997805b3590da8d8afdd19d193989078a (diff) | |
download | gitlab-ce-8f210aebe1d740e8ee194f171f1f33a6e1fba313.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project_wiki.rb')
-rw-r--r-- | app/models/project_wiki.rb | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index e0fcebf2642..bb222ac7629 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -17,13 +17,6 @@ class ProjectWiki CREATED_AT_ORDER = 'created_at' DIRECTION_DESC = 'desc' DIRECTION_ASC = 'asc' - SORT_ORDERS = [TITLE_ORDER, CREATED_AT_ORDER].freeze - SORT_DIRECTIONS = [DIRECTION_ASC, DIRECTION_DESC].freeze - - NESTING_FLAT = 'flat' - NESTING_TREE = 'tree' - NESTING_CLOSED = 'hidden' - NESTINGS = [NESTING_TREE, NESTING_CLOSED, NESTING_FLAT].freeze # Returns a string describing what went wrong after # an operation fails. @@ -65,11 +58,7 @@ class ProjectWiki end def wiki_base_path - ::File.join(project_base_path, 'wikis') - end - - def wiki_page_path - ::File.join(project_base_path, '-', 'wiki_pages') + [Gitlab.config.gitlab.relative_url_root, '/', @project.full_path, '/wikis'].join('') end # Returns the Gitlab::Git::Wiki object. @@ -136,23 +125,6 @@ class ProjectWiki end end - # Finds directory within the repository based on a slug - # - # dir_name - The directory prefix. - # - # Returns an initialized WikiDirectory instance or nil - def find_dir(dir_name, sort = nil, direction = DIRECTION_ASC) - descending = direction == DIRECTION_DESC - # WikiListPagesRequest currently does not support server-side - # filtering. Ideally this logic should be moved to the gitaly - # side. - pages = wiki - .list_pages(sort: sort, direction_desc: descending) - .map { |page| WikiPage.new(self, page, true) } - .select { |wp| wp.directory == dir_name } - WikiDirectory.new(dir_name, pages) if pages.present? - end - def find_sidebar(version = nil) find_page(SIDEBAR, version) end @@ -172,12 +144,6 @@ class ProjectWiki false end - def build_page(attrs) - WikiPage.new(self).tap do |page| - page.update_attributes(attrs) # rubocop:disable Rails/ActiveRecordAliases - end - end - def update_page(page, content:, title: nil, format: :markdown, message: nil) commit = commit_details(:updated, message, page.title) @@ -205,7 +171,7 @@ class ProjectWiki title_array = title.split("/") title = title_array.pop - [title, ::File.join(title_array)] + [title, title_array.join("/")] end def repository @@ -232,10 +198,6 @@ class ProjectWiki private - def project_base_path - ::File.join(Gitlab.config.gitlab.relative_url_root, @project.full_path) - end - def create_repo!(raw_repository) gitlab_shell.create_wiki_repository(project) |