diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-19 15:09:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-19 15:09:33 +0300 |
commit | 652bd073731b0028641672a75355c7918b5ac116 (patch) | |
tree | e0239f98153492ac89c6fc374c5dfd1aa270d8bf /app/models/wiki_page.rb | |
parent | 2af90cef2e2e9c776eae4394a43dba3be7f33d1e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 5436f034657..fb65432024e 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -21,6 +21,14 @@ class WikiPage ActiveModel::Name.new(self, nil, 'wiki') end + def eql?(other) + return false unless other.present? && other.is_a?(self.class) + + slug == other.slug && wiki.project == other.wiki.project + end + + alias_method :==, :eql? + # Sorts and groups pages by directory. # # pages - an array of WikiPage objects. @@ -58,6 +66,7 @@ class WikiPage # The GitLab ProjectWiki instance. attr_reader :wiki + delegate :project, to: :wiki # The raw Gitlab::Git::WikiPage instance. attr_reader :page @@ -70,6 +79,10 @@ class WikiPage Gitlab::HookData::WikiPageBuilder.new(self).build end + # Construct a new WikiPage + # + # @param [ProjectWiki] wiki + # @param [Gitlab::Git::WikiPage] page def initialize(wiki, page = nil) @wiki = wiki @page = page |