Skip to content

Conversation

@fbacall
Copy link
Member

@fbacall fbacall commented Dec 22, 2025

Summary of changes

  • Adds checkboxes on the space management page to switch certain features off.
  • Hides tabs etc. if features are disabled within the current space.

Motivation and context

Fixes #1205

Screenshots

image image

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.

Copy link
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

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_features array column to the spaces table 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.

Comment on lines +567 to +577
features = {
'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
Copy link

Copilot AI Dec 22, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +604 to +609
features = {
'events': true,
'materials': true,
'workflows': true,
'spaces': true
}
Copy link

Copilot AI Dec 22, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +641 to +651
features = {
'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
Copy link

Copilot AI Dec 22, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +675 to +682
features = {
'events': true,
'materials': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
Copy link

Copilot AI Dec 22, 2025

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.

Copilot uses AI. Check for mistakes.

<!-- WORKFLOWS -->
<% if TeSS::Config.feature['workflows'] == true %>
<% if TeSS::Config.feature['workflows'] %>
Copy link

Copilot AI Dec 22, 2025

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.

Suggested change
<% if TeSS::Config.feature['workflows'] %>
<% if Space.current_space.feature_enabled?('workflows') %>

Copilot uses AI. Check for mistakes.
Comment on lines +529 to +539
features = {
'events': true,
'materials': true,
'elearning_materials': true,
'workflows': true,
'collections': true,
'content_providers': true,
'trainers': true,
'nodes': true,
'spaces': true
}
Copy link

Copilot AI Dec 22, 2025

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.

Copilot uses AI. Check for mistakes.
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.

Allow features to be toggled per space

2 participants