Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorIgor <idrozdov@gitlab.com>2019-04-12 16:25:17 +0300
committerDouwe Maan <douwe@gitlab.com>2019-04-12 16:25:17 +0300
commitcfb94bca6f804c0dc762c5df2ed0a2c0d7c4c973 (patch)
treeb052d191a73155b141ee77f93a4290e2523a7558 /app
parent004e8627218dc7621b5ff2e66b2b510c0afdcefc (diff)
Fix grouping wiki pages by directory
If a page has the same name as a directory the WikiPage#group_by_directory method can have a wrong behaviour This commit fixes it
Diffstat (limited to 'app')
-rw-r--r--app/models/wiki_page.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 909da4316d0..cd4c7895587 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -31,7 +31,9 @@ class WikiPage
pages.each_with_object([]) do |page, grouped_pages|
next grouped_pages << page unless page.directory.present?
- directory = grouped_pages.find { |dir| dir.slug == page.directory }
+ directory = grouped_pages.find do |obj|
+ obj.is_a?(WikiDirectory) && obj.slug == page.directory
+ end
next directory.pages << page if directory