Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Fix #110 Skip deleted comments #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,13 @@ class BitbucketClient(config: SonarBBPluginConfig) {
Option(comment("user").asInstanceOf[Map[String, Any]])
.getOrElse(Map("uuid" -> ""))("uuid").asInstanceOf[String] equals uuid

def isDeleted(comment: Map[String, Any]): Boolean =
Option(comment("deleted").asInstanceOf[Boolean]).getOrElse(false)

def fetchPullRequestCommentsPage(start: Int): (Option[Int], Seq[PullRequestComment]) = {
fetchPage(s"/pullrequests/${pullRequest.id}/comments", f =
response =>
for (comment <- response("values").asInstanceOf[Seq[Map[String, Any]]] if isFromUs(comment))
for (comment <- response("values").asInstanceOf[Seq[Map[String, Any]]] if isFromUs(comment) && !isDeleted(comment))
yield {
val commentId = comment("id").asInstanceOf[Int]
val content = comment("content").asInstanceOf[Map[String, Any]]("raw").asInstanceOf[String]
Expand Down