Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rest): modify moderation requests #1889

Merged

Conversation

GMishx
Copy link
Member

@GMishx GMishx commented Mar 29, 2023

The PR adds new HTTP verbs to endpoint /moderationrequest to modify ModerationRequests from REST API.

  • Which issue is this pull request belonging to and how is it solving it?

PR is related to issue #1849

  • Did you add or update any new dependencies that are required for your change?

No

Issue: #1849

Suggest Reviewer

You can suggest reviewers here with an @mention.

How To Test?

How should these changes be tested by the reviewer?

Create several moderation requests to perform following actions on the endpoint.

  • PATCH /moderationrequest/{id}
    • With action as ACCEPT in body and some comment, the request should accept the MR.
  • PATCH /moderationrequest/{id}
    • With action as REJECT in body and some comment, the request should reject the MR.
  • PATCH /moderationrequest/{id}
    • With action as ASSIGN in body, the request should assign the MR to the caller and set the status to "in progress".
  • PATCH /moderationrequest/{id}
    • With action as ASSIGN in body, for a MR where caller is not a moderator should throw error.
  • PATCH /moderationrequest/{id}
    • With action as UNASSIGN in body, the request should remove the caller from the moderator list of the MR and set the status to "pending".
  • PATCH /moderationrequest/{id}
    • With action as UNASSIGN in body, for a MR with only one moderator should throw error.

Have you implemented any additional tests?

REST documentation tests.

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@GMishx GMishx added WIP work in progress needs code review REST New-UI Level for the API and UI level changes for the new-ui labels Mar 29, 2023
@GMishx GMishx changed the title Feat/api/moderation request accept feat(rest): modify moderation requests Mar 29, 2023
@GMishx GMishx force-pushed the feat/api/moderationRequest-accept branch from 0daf18b to 0e10fd3 Compare April 7, 2023 11:57
@GMishx GMishx force-pushed the feat/api/moderationRequest-accept branch 2 times, most recently from f969681 to 5e035d6 Compare May 11, 2023 15:50
@GMishx GMishx removed the WIP work in progress label May 11, 2023
@GMishx GMishx marked this pull request as ready for review May 11, 2023 15:50
@ag4ums ag4ums added the needs general test This is general testing, meaning that there is no org specific issue to check for label May 17, 2023
@rudra-superrr
Copy link
Contributor

Things that I found while testing,

  1. Getting message "You are the last moderator for this request - you are not allowed to unsubscribe" even if the reviewer is not a moderator.
  2. Un assigning a user from a moderator list gives 202 status code i.e. it is removed from the mod list but if we run the same unassign api call then it will again give 202 status code.

@GMishx GMishx force-pushed the feat/api/moderationRequest-accept branch 2 times, most recently from 54c5664 to 9b4aa34 Compare May 22, 2023 10:47
@rudra-superrr
Copy link
Contributor

rudra-superrr commented May 23, 2023

500 status code coming when accept or reject operation is performed for a user which is not a moderator.
Same for unassign operation.
image

@GMishx GMishx force-pushed the feat/api/moderationRequest-accept branch from 9b4aa34 to 7a9ee03 Compare May 25, 2023 08:43
@GMishx
Copy link
Member Author

GMishx commented May 25, 2023

Added an exception handler for the same @rudra-superrr . Also, blocked all calls to closed MRs.

Please have a look

@rudra-superrr
Copy link
Contributor

Testing was successful.

@rudra-superrr rudra-superrr removed the needs general test This is general testing, meaning that there is no org specific issue to check for label May 26, 2023
Modify ModerationRequest being
- Accepted
- Rejected
- Assigned (In progress)
- Unassigned (Pending)

Commit is related to issue eclipse-sw360#1849

Signed-off-by: Gaurav Mishra <[email protected]>
@GMishx GMishx force-pushed the feat/api/moderationRequest-accept branch from 7a9ee03 to 0481e60 Compare May 31, 2023 05:55
@rudra-superrr
Copy link
Contributor

Code looks good.

@rudra-superrr rudra-superrr added ready ready to merge and removed needs code review labels Jun 6, 2023
@heliocastro heliocastro merged commit 90c59ac into eclipse-sw360:main Jun 6, 2023
@GMishx GMishx deleted the feat/api/moderationRequest-accept branch June 6, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New-UI Level for the API and UI level changes for the new-ui ready ready to merge REST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants