Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixes #3140 - Publish private issue in public after moderation #3167
This basically push the action processing on issues out of the route. It adds a generic function that can be further refined and handles multiple actions. Some goals: * easier to read * easier to test * more flexibility for growth
Still in the process of making the code more readable. repo_scope will provide a way to know if we are dealing with a public or a private repo. It makes it easier to scope the actions to certain consequences and it makes it more readable and testable.
There is a couple of things to unpack here. * Simplifies the json fixture so we focus on what we need. * Adds a test which is handling **only** the HTTP workflow of the webhook note they start to repeat a bit, and we probably need to functionalize this a bit at a point. We will see that at the end. * Moves logging where it should have been in previous commit. My bad. * Modifies the dictionary we use with the info we need to add a milestoned_with keyword * Test that the payload has the right criteria before processing it. This doesn't contain the actual posting to the public repo **yet** Because there will be probably related to #3141 too.
This will make it a bit clearer in the code. Instead of manipulating two types of data, we focus only on one structured dictionary
Basically we have a structured dictionary which contains all the info we need. This will be sent to the repo for updating the public issue. There's still a bit of data massaging to make it proper in `private_issue_moderation` (Probably once this is all done, we would need to rebase all of this or create a new branch with a proper set of commits.)
This creates a separate function in charge of preparing the payload. - It removes the action-needsmoderation label - It grabs the required body - It grabs the title of the issue This will make it easier to test if/when we change what we want to send as a payload.
The tests call indirectly extract_priority_label which triggers a different result if the db is populated or not. So instead of having a variation, we force the return value of the priority for this specific case.
We make sure that we send the HTTP PATCH with the right arguments. So basically that we are sending the right information at the right place. A question though: do we want to send the public_url in the body?
This double checks that the processing for issue moderation is coming from the right scope. Often probably a wrong repo. That would prevent us from a copy pasta error.
This should be the final patch for the new anonymous workflow. When the issue has been moderated as rejected, we need to change a couple of things in the public space - change Title - change body - close the issue - remove the action-needsmoderation label - change the milestone to invalid This is the companion for #3140 Once this is merged on staging, we can activate #3155 on the private test repo, then on the public repo.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.