danger 5.5.2 → 5.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 336ff138e13d844d9c929f28ddea10a1a5a580a4
4
- data.tar.gz: 359ee0f4fd27a7e7bf76ae43f20ee0433b8d6056
3
+ metadata.gz: 1d75a6731cebfdb3a94769a4b7feeb516a03b6d6
4
+ data.tar.gz: b376cef50c81d7d0b6c79faab79c913b28b49543
5
5
  SHA512:
6
- metadata.gz: 512935e983933356dfc82a642a878a665c7163c1461c95108444a59b5cdefc38b3a0bc6f089df4465d357c66536e7020de960a2d7390faf5f46957f66efd17ff
7
- data.tar.gz: '0682177cce8bce5ce8109fd686f9329196758e98c674e79506b78eab71cc26a8ee7df03f479b310f7b65e93e996145cd6fab4643d1927c61cd23028246f1e1cc'
6
+ metadata.gz: f61c8acf0c455cf6aa64b3d99beade05a612c1793b9c0fde6bb44926e9cc748c6604b068b3c73bc3524aa6cf12c0bb2aedfb03fcabbe352fb3d916b34f70a988
7
+ data.tar.gz: f14d5fad53e755eef0e0474882db237be1609486a4f89435138a236fb1f420fce8fb7bf80860a7ddb1682bd240a01432859e4fd54adbf9556ebaaa4cf683113e
@@ -87,21 +87,31 @@ module Danger
87
87
  danger_id: danger_id,
88
88
  template: "vsts")
89
89
  if new_comment
90
- @api.post_comment(comment)
90
+ post_new_comment(comment)
91
91
  else
92
92
  update_old_comment(comment, danger_id: danger_id)
93
93
  end
94
94
  end
95
95
 
96
+ def post_new_comment(comment)
97
+ @api.post_comment(comment)
98
+ end
99
+
96
100
  def update_old_comment(new_comment, danger_id: "danger")
101
+ comment_updated = false
97
102
  @api.fetch_last_comments.each do |c|
98
103
  thread_id = c[:id]
99
104
  comment = c[:comments].first
100
105
  comment_id = comment[:id]
101
106
  comment_content = comment[:content].nil? ? "" : comment[:content]
102
-
103
- @api.update_comment(thread_id, comment_id, new_comment) if comment_content.include?("generated_by_#{danger_id}")
107
+ # Skip the comment if it wasn't posted by danger
108
+ next unless comment_content.include?("generated_by_#{danger_id}")
109
+ # Updated the danger posted comment
110
+ @api.update_comment(thread_id, comment_id, new_comment)
111
+ comment_updated = true
104
112
  end
113
+ # If no comment was updated, post a new one
114
+ post_new_comment(new_comment) unless comment_updated
105
115
  end
106
116
  end
107
117
  end
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "5.5.2".freeze
2
+ VERSION = "5.5.3".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.2
4
+ version: 5.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-04 00:00:00.000000000 Z
12
+ date: 2017-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide