diff --git a/CHANGELOG.md b/CHANGELOG.md index 65434567..fee303e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Changes + +* [#58](https://github.com/mmozuras/pronto/pull/58): GitlabFormatter uses a high +per_page+ value to avoid pagination (and thus duplicate comments) ## 0.4.0 diff --git a/lib/pronto/gitlab.rb b/lib/pronto/gitlab.rb index 9584fa5a..ab237030 100644 --- a/lib/pronto/gitlab.rb +++ b/lib/pronto/gitlab.rb @@ -7,7 +7,7 @@ def initialize(repo) def commit_comments(sha) @comment_cache["#{sha}"] ||= begin - client.commit_comments(slug, sha).map do |comment| + client.commit_comments(slug, sha, per_page: 500).map do |comment| Comment.new(sha, comment.note, comment.path, comment.line) end end diff --git a/spec/pronto/gitlab_spec.rb b/spec/pronto/gitlab_spec.rb index d013f55c..301b6574 100644 --- a/spec/pronto/gitlab_spec.rb +++ b/spec/pronto/gitlab_spec.rb @@ -17,7 +17,7 @@ module Pronto ::Gitlab::Client.any_instance .should_receive(:commit_comments) - .with('mmozuras%2Fpronto', sha) + .with('mmozuras%2Fpronto', sha, per_page: 500) .once .and_return([])