Skip to content

GlobalSpace & DefaultSpace#1290

Open
fbacall wants to merge 3 commits intomasterfrom
global-space
Open

GlobalSpace & DefaultSpace#1290
fbacall wants to merge 3 commits intomasterfrom
global-space

Conversation

@fbacall
Copy link
Copy Markdown
Member

@fbacall fbacall commented Apr 22, 2026

Summary of changes

  • Separate GlobalSpace and DefaultSpace concepts. The former includes all resources, the latter includes only "default space" resources (where space_id is null).

Motivation and context

#1286

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree to license it to the TeSS codebase under the BSD license.

@fbacall fbacall requested a review from Copilot April 22, 2026 12:33
@fbacall fbacall changed the title Filter resources in DefaultSpace. Use GlobalSpace when spaces dis… GlobalSpace & DefaultSpace Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Separates the “default space” concept (resources with space_id: nil) from a new “global space” concept (all resources), fixing the issue where DefaultSpace incorrectly selected all items when spaces are enabled.

Changes:

  • Updated Space.default to return DefaultSpace when spaces are enabled, otherwise GlobalSpace.
  • Introduced GlobalSpace and refactored DefaultSpace to inherit from it while overriding resource relations to scope to space_id: nil.
  • Added model tests to validate default space selection and basic resource scoping behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/models/space.rb Switches Space.default implementation to choose between DefaultSpace and GlobalSpace based on the feature flag.
app/models/global_space.rb Adds GlobalSpace implementation that exposes unscoped (“all resources”) relations and site-level metadata.
app/models/default_space.rb Refactors DefaultSpace to inherit from GlobalSpace and overrides relations to filter space_id: nil.
app/controllers/application_controller.rb Adjusts set_current_space behavior when spaces are disabled.
test/models/space_test.rb Adds tests for Space.default selection and validates resource scoping for materials.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/controllers/application_controller.rb Outdated
Comment thread test/models/space_test.rb
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.

2 participants