sw360portal
sw360portal copied to clipboard
Wrong deletion of moderation requests after accepting or refusing
An error is thrown after accepting a delete moderation request (for projects, components and releases).
The reason is the following:
After commit 6acac74e
, ModerationPortlet.renderActionView
now contains the lines
} else if (ACTION_ACCEPT.equals(action)) {
String requestingUserEmail = moderationRequest.getRequestingUser();
User requestingUser = UserCacheHolder.getUserFromEmail(requestingUserEmail);
acceptModerationRequest(user, requestingUser, moderationRequest, request);
client.acceptRequest(id, moderationComment, user.getEmail());
(and similar for declining a request).
-
The function
acceptModerationRequest
(e.g. for accepting a project delete request) leads to theProjectDatabasehandler.removeProjectAndCleanUp
, which removes the project from the database and callsProjectModerator.notifyModeratorOnDelete
. But this method does not notify the moderator but rather deletes the moderation request from the database. -
The function
client.acceptRequest
tries to set theModerationState
of the request to approved, but fails as the request is already deleted. In the end, this results in aNullPointerException
.
Long story short, I believe that ProjectModerator.notifyModeratorOnDelete
should be corrected to not delete the moderation request. Also, the naming of the two "acceptRequest"-functions (and also decline-functions) in ModerationPortlet.renderActionView
is confusing.
@alexbrdn Could you have a look at it?
I guess I have to. What, after introducing all these problems...