Space-specific sources#1193
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements space-specific sources functionality, allowing sources to be tied to specific spaces within the TeSS platform. Resources ingested from a source now inherit the source's space, and space administrators gain the ability to manage sources within their spaces.
Key changes:
- Sources can now be associated with a space via new
space_idforeign key - Resources created by ingestors inherit the space from their source
- Cross-space content filtering is now available to all users (previously admin-only)
Reviewed changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
db/migrate/20250807085314_add_space_id_to_sources.rb |
Adds space_id foreign key to sources table |
db/schema.rb |
Updated schema with space_id column and foreign key for sources |
app/models/source.rb |
Includes InSpace module for space association |
app/models/default_space.rb |
Adds administrators method returning admin users |
app/models/user.rb |
Adds has_role_in_any_space? helper method |
lib/ingestors/ingestor.rb |
Sets space_id on ingested resources from source |
lib/facets.rb |
Removes admin-only restriction from across_all_spaces filter |
app/policies/application_policy.rb |
Adds helper methods for space-aware role checks (user_has_role?, scraper?) |
app/policies/source_policy.rb |
Updates approve? to use user_has_role? helper |
app/policies/content_provider_policy.rb |
Adds create_source? policy method |
app/policies/*_policy.rb |
Refactors to use new helper methods from ApplicationPolicy |
app/controllers/sources_controller.rb |
Sets space on source creation; updates authorization to use create_source? |
app/controllers/*_controller.rb |
Changes redirect URLs from _url to _path helpers |
app/mailers/curation_mailer.rb |
Sends source approval emails to space administrators |
app/views/search/common/_facet_sidebar*.html.erb |
Moves cross-space filter to main sidebar (available to all) |
app/views/layouts/_user_menu.html.erb |
Adds space admin menu items with proper permission checks |
app/views/spaces/* |
UI improvements including theme selector and space listing |
app/assets/stylesheets/* |
Styling updates for theme selector and block items |
config/tess.example.yml |
Fixes missing # in green theme color code |
config/locales/en.yml |
Updates cross-space filter text and adds current_space_admin label |
test/* |
Comprehensive tests for space-based source permissions and functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| provider = content_providers(:portal_provider) | ||
| space = spaces(:plants) | ||
|
|
||
| # Source has default language set |
There was a problem hiding this comment.
Inaccurate comment: The comment says "Source has default language set" but this test is about setting the space from the source, not the default language. Update the comment to accurately reflect what the test is demonstrating, such as "Source has space set".
Tweak filter wording to be more accurate to function
Operator precedence clarity & fixes etc. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
40c10ce to
0f60d62
Compare
Summary of changes
Motivation and context
Allows ingestors to be used in spaces.
Checklist
to license it to the TeSS codebase under the
BSD license.