Skip to content

Commit 482d3a0

Browse files
committed
fix(component): allow mr comment with delete
Allow comment for moderation request while sending a delete request for a component. Signed-off-by: Gaurav Mishra <[email protected]>
1 parent 19337ae commit 482d3a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/component/ComponentController.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import io.swagger.v3.oas.annotations.media.Schema;
2323
import io.swagger.v3.oas.annotations.responses.ApiResponse;
2424
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
25+
import org.apache.commons.lang3.StringUtils;
2526
import org.eclipse.sw360.datahandler.common.CommonUtils;
2627
import org.eclipse.sw360.datahandler.common.SW360Constants;
2728
import org.eclipse.sw360.datahandler.common.SW360Utils;
@@ -426,9 +427,14 @@ public ResponseEntity<EntityModel<Component>> patchComponent(
426427
@RequestMapping(value = COMPONENTS_URL + "/{ids}", method = RequestMethod.DELETE)
427428
public ResponseEntity<List<MultiStatus>> deleteComponents(
428429
@Parameter(description = "The ids of the components to be deleted.")
429-
@PathVariable("ids") List<String> idsToDelete
430+
@PathVariable("ids") List<String> idsToDelete,
431+
@Parameter(description = "Comment message")
432+
@RequestParam(value = "comment", required = false) String comment
430433
) throws TException {
431434
User user = restControllerHelper.getSw360UserFromAuthentication();
435+
if (StringUtils.isNotEmpty(comment)) {
436+
user.setCommentMadeDuringModerationRequest(comment);
437+
}
432438
List<MultiStatus> results = new ArrayList<>();
433439
for(String id:idsToDelete) {
434440
RequestStatus requestStatus = componentService.deleteComponent(id, user);

0 commit comments

Comments
 (0)