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

Add Waffle Flag for Submissions #22729

Merged
merged 12 commits into from
Oct 15, 2024

Conversation

chrstinalin
Copy link
Contributor

@chrstinalin chrstinalin commented Oct 1, 2024

Fixes: mozilla/addons#1830

Description

Adds waffle flag enable-submissions to disable add-on related submissions (both new add-ons and versions) when toggled to false for a particular group on both DevHub and the API. Includes the endpoints:

  1. POST api/v5/addons/addon/
  2. PUT (CREATE) api/v5/addons/addon/<guid>/
  3. POST api/v5/addons/addon/<guid>/versions/
  4. POST api/v5/addons/addon/<guid>/previews/
  5. PUT api/v4/addons/
  6. POST api/v4/addons/<guid>/versions/<version>
  7. PUT api/v3/addons/
  8. POST api/v3/addons/<guid>/versions/<version>

The waffle flag's 'note' can be used to add additional information. The API response:

{
    "error": "Submissions are not currently available.",
    "reason": "This is the note reason."
}

And on DevHub:
image
image

Testing

  1. Deactivate the enable-submissions waffle flag (everyone should be = True by default).
  2. On DevHub, all URLs pointing to a) uploading a new add-on, or b) uploading a new version are blocked.
  3. Any API requests to endpoints that do the same return the error.

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).

@chrstinalin chrstinalin marked this pull request as draft October 1, 2024 19:42
@chrstinalin chrstinalin marked this pull request as ready for review October 3, 2024 19:26
@chrstinalin chrstinalin requested review from a team and diox and removed request for a team October 3, 2024 19:27
@diox
Copy link
Member

diox commented Oct 7, 2024

Can you refactor the conditions in the views into a decorator or two (one for APIs, one for "regular" views) to reduce duplicated code ?

Copy link
Member

@diox diox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be a little more subtle than that (sorry it was so poorly specified in the issue):

  • We don't need to completely block all steps of the submission process. Let's only block the part where the add-on is being submitted, that's what matters - for the rest, it's too late anyway.
  • On the page where the developer is selecting the file, let's allow access to the page if it's a GET, but disable the inputs/buttons and show the error message there. Or even replace the entire with the message, whatever is easier. That way developers should never be surprised (and in theory shouldn't hit the 403 submissions_disabled.html page, unless they tried to be sneaky or submitted right when the flag was modified)

@chrstinalin chrstinalin requested a review from diox October 9, 2024 17:31
@diox diox self-requested a review October 11, 2024 10:53
Copy link
Member

@diox diox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong button before, didn't mean to approve, definitely need changes.

@chrstinalin chrstinalin requested a review from diox October 11, 2024 14:26
Copy link
Member

@diox diox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can ship this, but create an issue to address these points in a follow-up:

  • The Theme Submission page (/en-US/developers/addon/submit/theme/upload-listed) has the Create a theme button still enabled when the flag is off
  • The Theme Wizard page (that the aforementioned button leads to - /en-US/developers/addon/submit/wizard-listed) also has its submit button still enabled
  • Some warning should be displayed somewhere on the upload & theme wizard pages and not just on the title of the disabled buttons, to make it more obvious. With the full note for consistency.

@chrstinalin chrstinalin merged commit 5130dd1 into mozilla:master Oct 15, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add waffle flag to turn submissions on or off
2 participants