From cddb3d226e0afd06c4c43c58f702de991adc52fd Mon Sep 17 00:00:00 2001 From: Eric Giffon Date: Fri, 29 Dec 2023 15:00:34 +0100 Subject: [PATCH] SONAR-21378 Deprecate diff keys severity and type in api/issues/changelog --- .../server/issue/ws/ChangelogActionIT.java | 15 ++++++++----- .../server/issue/ws/ChangelogAction.java | 2 +- .../server/issue/ws/changelog-example.json | 22 +++++++++++++++---- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/ChangelogActionIT.java b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/ChangelogActionIT.java index 9b539ae0d35..546c8728ae6 100644 --- a/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/ChangelogActionIT.java +++ b/server/sonar-webserver-webapi/src/it/java/org/sonar/server/issue/ws/ChangelogActionIT.java @@ -286,12 +286,15 @@ public class ChangelogActionIT { userSession.logIn("john") .addProjectPermission(USER, project, file); db.issues().insertFieldDiffs(issueDto, new FieldDiffs() - .setUserUuid(user.getUuid()) - .setDiff("severity", "MAJOR", "BLOCKER") - .setWebhookSource("github") - .setExternalUser("toto") - .setCreationDate(new Date()) - .setCreationDate(DateUtils.parseDateTime("2014-03-04T23:03:44+0100"))); + .setUserUuid(user.getUuid()) + .setDiff("issueStatus", "OPEN", "ACCEPTED") + .setWebhookSource("github") + .setExternalUser("ext-user") + .setCreationDate(DateUtils.parseDateTime("2014-03-04T23:03:44+0100")), + new FieldDiffs() + .setDiff("from_branch", "branch-123", "main") + .setDiff("assignee", null, "assignee123") + .setCreationDate(DateUtils.parseDateTime("2014-03-04T23:05:44+0100"))); String result = tester.newRequest().setParam("issue", issueDto.getKey()).execute().getInput(); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java index a84b23dbf1f..1e2a66e8b19 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/ChangelogAction.java @@ -57,7 +57,7 @@ public class ChangelogAction implements IssuesWsAction { .setSince("4.1") .setChangelog( new Change("10.4", "'issueStatus' key is added in the differences"), - new Change("10.4", "'status' and 'resolution' keys are now deprecated in the differences"), + new Change("10.4", "'status', 'resolution', 'severity' and 'type' keys are now deprecated in the differences"), new Change("9.7", "'externalUser' and 'webhookSource' information added to the answer"), new Change("6.3", "changes on effort is expressed with the raw value in minutes (instead of the duration previously)")) .setHandler(this) diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/issue/ws/changelog-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/issue/ws/changelog-example.json index 04454c24a7c..0bba49aaee0 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/issue/ws/changelog-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/issue/ws/changelog-example.json @@ -6,13 +6,27 @@ "isUserActive": true, "avatar": "b0d8c6e5ea589e6fc3d3e08afb1873bb", "creationDate": "2014-03-04T23:03:44+0100", - "externalUser": "toto", + "externalUser": "ext-user", "webhookSource": "github", "diffs": [ { - "key": "severity", - "newValue": "BLOCKER", - "oldValue": "MAJOR" + "key": "issueStatus", + "newValue": "ACCEPTED", + "oldValue": "OPEN" + } + ] + }, + { + "creationDate": "2014-03-04T23:05:44+0100", + "diffs": [ + { + "key": "from_branch", + "newValue": "main", + "oldValue": "branch-123" + }, + { + "key": "assignee", + "newValue": "assignee123" } ] } -- 2.39.5