sw360portal icon indicating copy to clipboard operation
sw360portal copied to clipboard

Wrong deletion of moderation requests after accepting or refusing

Open ChristophNiehoff opened this issue 7 years ago • 2 comments

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 the ProjectDatabasehandler.removeProjectAndCleanUp, which removes the project from the database and calls ProjectModerator.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 the ModerationState of the request to approved, but fails as the request is already deleted. In the end, this results in a NullPointerException.

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.

ChristophNiehoff avatar Sep 07 '17 15:09 ChristophNiehoff

@alexbrdn Could you have a look at it?

ChristophNiehoff avatar Sep 07 '17 15:09 ChristophNiehoff

I guess I have to. What, after introducing all these problems...

alexbrdn avatar Sep 07 '17 15:09 alexbrdn