Skip to content

Remove default scope excluding scratch projects #558

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

Merged
merged 5 commits into from
Jun 6, 2025

Conversation

floehopper
Copy link
Contributor

This removes the default scope on Project that hid scratch projects by default which was originally added in #513 to support work on the Experience CS project while leaving Code Editor, Code Editor for Education, etc, unaffected.

The Code Editor team are going to add protection to editor-standalone and editor-ui so that they show an error message and/or redirect the user if they are unintentionally used to load a scratch project. Once this protection is in place, we'll be able to apply the changes in this pull request to remove the default scope so that scratch projects are no longer hidden. This is necessary to support ongoing integration between Experience CS and Code Editor for Education.

As we agreed, I haven't made any changes to the GraphQL endpoint. In any case, I think any changes to filter on project_type would need to be made on the client side.

I decided not to fully revert all the changes, because I think extracting the project type string literals into Project::Types::PYTHON, Project::Types::HTML & Project::Types::SCRATCH is still a useful change. And because of that and some later changes, I wasn't able to simply revert a couple of the commits, so I constructed those commits manually.

I decided to remove the scratch_only scoping mechanism as well as the default scope, because I don't think we really need it in experience-cs - I think we can probably replace it with something similar to what the Code Editor team are going to do, i.e. display an error and/or redirect if the app is unintentionally used to load a non-scratch project. Having said that, there's no need to wait for us to make that change before merging this pull request.

Copy link
Contributor

@loiswells97 loiswells97 left a comment

Choose a reason for hiding this comment

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

Just a few questions on here, but apart from that, looking great and keen to get this in

@floehopper
Copy link
Contributor Author

@loiswells97

Just a few questions on here, but apart from that, looking great and keen to get this in

Many thanks for your reviewing. I've responded to your questions inline. Let me know if you need any further clarification or want me to change anything before merging.

Also can you confirm that you now have the measures we discussed in place in editor-standalone & editor-ui to handle the case where someone tries to load a scratch project into the Code Editor? Just wanted to triple-check!

loiswells97 added a commit that referenced this pull request Jun 5, 2025
## Status

Related to
RaspberryPiFoundation/digital-editor-issues#648
and #558

## What's changed?

- Added project type to the project context route to support redirecting
away from Scratch projects on the frontend
- Removed project finished data from the lessons index (which appears
not to have been used and was throwing errors)
@loiswells97
Copy link
Contributor

Many thanks for your reviewing. I've responded to your questions inline. Let me know if you need any further clarification or want me to change anything before merging.

Also can you confirm that you now have the measures we discussed in place in editor-standalone & editor-ui to handle the case where someone tries to load a scratch project into the Code Editor? Just wanted to triple-check!

Thanks James @floehopper, we've just merged the frontend changes and a small backend tweak to support this, so Scratch projects shouldn't get shown in the editor and editor site should redirect people if they hit a direct link to a scratch project. Once we've got this PR in we can check things out on staging a bit more easily.

Only remaining thought is the comment I've replied to above, otherwise happy with this.

Copy link
Contributor

@loiswells97 loiswells97 left a comment

Choose a reason for hiding this comment

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

Looks good, let's get this out there 🚢

This effectively reverts this commit [1] from #513, but keeps some of
the other changes [2,3] from #513.

Note that at this point the examples in
`spec/requests/projects/destroy_spec.rb` and
`spec/features/project/updating_a_project_spec.rb` which have been added
since #513 can't possible work with the default scope still in place,
but without the scratch-only option.

I've also updated `lib/tasks/projects.rake` which has also changed
since #513 to cope with the removal of the `only_scratch` scope.

I plan to remove the default scope in a subsequent commit which will
effectively revert the only other commi [4] from #513 at which point
those examples should pass again.

[1]: 56022c6
[2]: 64d9e89
[3]: 920fd62
[4]: caf1a57
This effectively reverts this commit [1] from #513.

The change in `spec/requests/projects/destroy_spec.rb` is to an example
which has been added since #513.

[1]: caf1a57
@floehopper
Copy link
Contributor Author

Rebasing on main and force-pushing in preparation for merging.

@floehopper floehopper force-pushed the remove-default-scope-excluding-scratch-projects branch from 85a9c10 to 6d86cc8 Compare June 6, 2025 10:33
@floehopper floehopper marked this pull request as ready for review June 6, 2025 10:33
@floehopper floehopper temporarily deployed to editor-api-p-remove-def-aamviv June 6, 2025 10:33 Inactive
@floehopper floehopper merged commit f397e87 into main Jun 6, 2025
3 checks passed
@floehopper floehopper deleted the remove-default-scope-excluding-scratch-projects branch June 6, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants