diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/models/wiki_page.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 3b9a7ded83e..9ae5a870323 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -127,10 +127,21 @@ class WikiPage @path ||= @page.path end + # Returns a CommitCollection + # + # Queries the commits for current page's path, equivalent to + # `git log path/to/page`. Filters and options supported: + # https://gitlab.com/gitlab-org/gitaly/-/blob/master/proto/commit.proto#L322-344 def versions(options = {}) return [] unless persisted? - wiki.wiki.page_versions(page.path, options) + default_per_page = Kaminari.config.default_per_page + offset = [options[:page].to_i - 1, 0].max * options.fetch(:per_page, default_per_page) + + wiki.repository.commits('HEAD', + path: page.path, + limit: options.fetch(:limit, default_per_page), + offset: offset) end def count_versions |