Skip to content

Commit

Permalink
SLI-1604 Should display error when no permission to resolve issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Sep 17, 2024
1 parent 932a086 commit 61b1aa9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,24 @@ class MarkAsResolvedAction(
val serverKey = issue.getServerKey() ?: issue.getId().toString()
val response = checkPermission(project, connection, serverKey) ?: return

runOnUiThread(project) {
val resolution = MarkAsResolvedDialog(
project,
connection,
response,
).chooseResolution() ?: return@runOnUiThread
if (confirm(project, connection.productName, resolution.newStatus)) {
markAsResolved(project, module, issue, resolution, serverKey)
if (response.isPermitted) {
runOnUiThread(project) {
val resolution = MarkAsResolvedDialog(
project,
connection,
response,
).chooseResolution() ?: return@runOnUiThread
if (confirm(project, connection.productName, resolution.newStatus)) {
markAsResolved(project, module, issue, resolution, serverKey)
}
}
} else {
SonarLintConsole.get(project).info("Could not resolve the issue, reason: ${response.notPermittedReason}")
SonarLintProjectNotifications.get(project)
.displayErrorNotification(
"Could not resolve the issue, reason: ${response.notPermittedReason}",
NotificationGroupManager.getInstance().getNotificationGroup(REVIEW_ISSUE_GROUP)
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ class MarkAsResolvedDialog(
}
}
centerPanel = MarkAsResolvedPanel(connection, permissionCheckResponse.allowedStatuses) { changeStatusAction.isEnabled = permissionCheckResponse.isPermitted && it }
if (!permissionCheckResponse.isPermitted) {
setErrorText(permissionCheckResponse.notPermittedReason)
}
init()
}

Expand Down

0 comments on commit 61b1aa9

Please sign in to comment.