diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/models/wiki_page.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 319cdd38d93..9e4e2f68d38 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -261,8 +261,7 @@ class WikiPage # Relative path to the partial to be used when rendering collections # of this object. def to_partial_path - # TODO: Move into shared/ with https://gitlab.com/gitlab-org/gitlab/-/issues/196054 - 'projects/wikis/wiki_page' + '../shared/wikis/wiki_page' end def id @@ -271,7 +270,10 @@ class WikiPage def title_changed? if persisted? - old_title, old_dir = wiki.page_title_and_dir(self.class.unhyphenize(page.url_path)) + # A page's `title` will be returned from Gollum/Gitaly with any +<> + # characters changed to -, whereas the `path` preserves these characters. + path_without_extension = Pathname(page.path).sub_ext('').to_s + old_title, old_dir = wiki.page_title_and_dir(self.class.unhyphenize(path_without_extension)) new_title, new_dir = wiki.page_title_and_dir(self.class.unhyphenize(title)) new_title != old_title || (title.include?('/') && new_dir != old_dir) |