lib/cc/presenters/pull_requests_presenter.rb in codeclimate-services-1.9.4 vs lib/cc/presenters/pull_requests_presenter.rb in codeclimate-services-1.9.5
- old
+ new
@@ -11,12 +11,18 @@
@new_count = issue_comparison_counts["new"]
end
@covered_percent = payload["covered_percent"]
@covered_percent_delta = payload["covered_percent_delta"]
+
+ @approved_by = payload["approved_by"].presence
end
+ def approved_message
+ "Approved by #{@approved_by}."
+ end
+
def error_message
"Code Climate encountered an error attempting to analyze this pull request."
end
def pending_message
@@ -38,10 +44,12 @@
message
end
def success_message
- if @new_count > 0 && @fixed_count > 0
+ if @approved_by
+ approved_message
+ elsif @new_count > 0 && @fixed_count > 0
"#{@new_count} new #{"issue".pluralize(@new_count)} (#{@fixed_count} fixed)"
elsif @new_count <= 0 && @fixed_count > 0
"#{@fixed_count} fixed #{"issue".pluralize(@fixed_count)}"
elsif @new_count > 0 && @fixed_count <= 0
"#{@new_count} new #{"issue".pluralize(@new_count)}"