-
Notifications
You must be signed in to change notification settings - Fork 20
Allow TeSS features to be disabled in a space #1208
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
…ed-features Add tests for Space model disabled_features field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds functionality to allow individual TeSS spaces to disable specific features (events, materials, workflows, etc.) independently from global feature settings. Space administrators can now selectively enable/disable features through checkboxes on the space management page, and the UI dynamically hides tabs and navigation elements for disabled features within that space.
Key changes:
- Added a
disabled_featuresarray column to thespacestable to track which features are disabled per space - Implemented space-aware feature checking via
Space.current_space.feature_enabled?(feature)method - Updated views throughout the application to respect space-level feature settings
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| db/migrate/20251222142740_add_disabled_features_to_spaces.rb | Adds migration to create the disabled_features array column |
| db/schema.rb | Updates schema to reflect the new disabled_features column |
| app/models/space.rb | Implements FEATURES constant, validation, and feature_enabled? method for space-specific feature checking |
| app/models/default_space.rb | Adds feature_enabled? method that falls back to global config for the default space |
| app/controllers/spaces_controller.rb | Updates permitted parameters to allow enabled_features array |
| app/helpers/spaces_helper.rb | Adds space_feature_options helper to generate checkbox options |
| app/views/spaces/_form.html.erb | Adds checkboxes for enabling/disabling features in space management form |
| app/views/layouts/_header.html.erb | Updates navigation tab visibility to respect space-disabled features |
| app/views/users/show.html.erb | Updates user profile tabs to hide based on space feature settings |
| app/views/users/_form.html.erb | Updates trainer details visibility based on space feature settings |
| app/views/trainers/index.html.erb | Updates registration button visibility based on space feature settings |
| app/views/nodes/show.html.erb | Updates node tabs and content to respect space feature settings |
| app/views/nodes/partials/_associated_node_info.html.erb | Updates node info visibility based on space feature settings |
| app/views/materials/_form.html.erb | Updates form field visibility based on space feature settings |
| app/views/learning_paths/_form.html.erb | Updates nodes dropdown visibility based on space feature settings |
| app/views/learning_path_topics/show.html.erb | Updates tabs and content visibility based on space feature settings |
| app/views/events/_form.html.erb | Updates nodes dropdown visibility based on space feature settings |
| app/views/content_providers/show.html.erb | Updates provider tabs and content to respect space feature settings |
| app/views/content_providers/partials/_content_provider_sidebar.html.erb | Updates sidebar visibility based on space feature settings |
| app/views/content_providers/_form.html.erb | Updates nodes dropdown visibility based on space feature settings |
| app/views/collections/show.html.erb | Updates collection tabs and curation buttons to respect space feature settings |
| app/views/about/tess.html.erb | Updates about page sections visibility based on space feature settings |
| app/views/about/developers.erb | Updates API examples visibility based on space feature settings |
| app/views/about/_links.html.erb | Updates quick links visibility based on space feature settings |
| app/views/about/_about_nav.html.erb | Updates navigation visibility based on space feature settings |
| app/views/static/home/_provider_carousel.html.erb | Updates carousel visibility based on space feature settings |
| config/locales/en.yml | Adds translation for "Features enabled" label |
| test/models/space_test.rb | Adds comprehensive tests for disabled_features functionality |
| test/controllers/static_controller_test.rb | Adds integration tests to verify feature visibility respects space settings |
| test/fixtures/spaces.yml | Adds user associations to space fixtures for proper test setup |
| test/fixtures/users.yml | Adds astro_owner and other_owner users for space fixture associations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| features = { | ||
| 'events': true, | ||
| 'materials': true, | ||
| 'elearning_materials': true, | ||
| 'workflows': true, | ||
| 'collections': true, | ||
| 'content_providers': true, | ||
| 'trainers': true, | ||
| 'nodes': true, | ||
| 'spaces': true | ||
| } |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent hash key syntax. The hash uses symbol keys with hash rockets (e.g., 'events': true) which is mixing old-style hash rockets with symbol keys. For consistency and Ruby best practices, either use the modern syntax (events: true) or traditional syntax (:events => true). The modern syntax (key: value) is preferred for symbol keys.
| features = { | ||
| 'events': true, | ||
| 'materials': true, | ||
| 'workflows': true, | ||
| 'spaces': true | ||
| } |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent hash key syntax. The hash uses symbol keys with hash rockets (e.g., 'events': true) which is mixing old-style hash rockets with symbol keys. For consistency and Ruby best practices, either use the modern syntax (events: true) or traditional syntax (:events => true). The modern syntax (key: value) is preferred for symbol keys.
| features = { | ||
| 'events': true, | ||
| 'materials': true, | ||
| 'elearning_materials': true, | ||
| 'workflows': true, | ||
| 'collections': true, | ||
| 'content_providers': true, | ||
| 'trainers': true, | ||
| 'nodes': true, | ||
| 'spaces': true | ||
| } |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent hash key syntax. The hash uses symbol keys with hash rockets (e.g., 'events': true) which is mixing old-style hash rockets with symbol keys. For consistency and Ruby best practices, either use the modern syntax (events: true) or traditional syntax (:events => true). The modern syntax (key: value) is preferred for symbol keys.
| features = { | ||
| 'events': true, | ||
| 'materials': true, | ||
| 'content_providers': true, | ||
| 'trainers': true, | ||
| 'nodes': true, | ||
| 'spaces': true | ||
| } |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent hash key syntax. The hash uses symbol keys with hash rockets (e.g., 'events': true) which is mixing old-style hash rockets with symbol keys. For consistency and Ruby best practices, either use the modern syntax (events: true) or traditional syntax (:events => true). The modern syntax (key: value) is preferred for symbol keys.
app/views/about/tess.html.erb
Outdated
|
|
||
| <!-- WORKFLOWS --> | ||
| <% if TeSS::Config.feature['workflows'] == true %> | ||
| <% if TeSS::Config.feature['workflows'] %> |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent feature checking pattern. This line still uses TeSS::Config.feature['workflows'] directly instead of Space.current_space.feature_enabled?('workflows'), which means the workflows section won't be hidden when workflows are disabled for a specific space. This is inconsistent with how other features like 'events' and 'materials' are checked on lines 41 and 62.
| <% if TeSS::Config.feature['workflows'] %> | |
| <% if Space.current_space.feature_enabled?('workflows') %> |
| features = { | ||
| 'events': true, | ||
| 'materials': true, | ||
| 'elearning_materials': true, | ||
| 'workflows': true, | ||
| 'collections': true, | ||
| 'content_providers': true, | ||
| 'trainers': true, | ||
| 'nodes': true, | ||
| 'spaces': true | ||
| } |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent hash key syntax. The hash uses symbol keys with hash rockets (e.g., 'events': true) which is mixing old-style hash rockets with symbol keys. For consistency and Ruby best practices, either use the modern syntax (events: true) or traditional syntax (:events => true). The modern syntax (key: value) is preferred for symbol keys.
Summary of changes
Motivation and context
Fixes #1205
Screenshots
Checklist
to license it to the TeSS codebase under the
BSD license.