Skip to content

Commit

Permalink
Merge pull request #58 from siebertm/fix-gitlab-comment-duplication
Browse files Browse the repository at this point in the history
Gitlab integration: comments are duplicated because of default 20-item pagination
  • Loading branch information
mmozuras committed Jan 29, 2015
2 parents 9a751e5 + c09bbdf commit b1e0cc9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/pronto/gitlab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/pronto/gitlab_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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([])

Expand Down

0 comments on commit b1e0cc9

Please # to comment.