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
Projects: projectValidator prop -> limitedGallery prop #24650
Conversation
// Due to risk of inappropriate content, we can hide non-featured Applab | ||
// and Gamelab projects via DCDO. Internally, project_validators should | ||
// always have access to all Applab and Gamelab projects, even if there is a // limited gallery for others. | ||
- limited_project_gallery = DCDO.get('image_moderation', {})['limited_project_gallery'] |
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.
Can we reuse or remove the helper we already wrote for this?
code-dot-org/lib/cdo/azure_content_moderator.rb
Lines 172 to 176 in c9ff823
# If true, we only show featured projects in the App Lab and Game Lab | |
# sections of the public project gallery. | |
def limited_project_gallery? | |
dynamic_config['limited_project_gallery'] || true | |
end |
We may need to make it a static method. If you decide to remove that one and do this inline, let's make sure we capture the "true by default" behavior.
It might also be nice to make limited_gallery?
a helper in projects_controller.rb and call that here instead of bothering with DCDO and UserPermission right here in the view.
// always have access to all Applab and Gamelab projects, even if there is a // limited gallery for others. | ||
- limited_project_gallery = DCDO.get('image_moderation', {})['limited_project_gallery'] | ||
- project_validator = current_user.permission? UserPermission::PROJECT_VALIDATOR | ||
- projects_data[:limitedGallery] = project_validator ? !project_validator : limited_project_gallery |
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.
project_validator ? !project_validator : limited_project_gallery
simplifies to
!project_validator && limited_project_gallery
@islemaster What do you think about the updates? Any other requested changes? |
👀 |
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.
🎉 LGTM!
Follow up to #24643
This PR uses the new DCDO parameter for
limited_gallery
to determine whether to hide or show the view more links for App Lab and Game Lab in the public project gallery. Previously, the decision to show/hide the view more link was based solely on whether the user has project validator permissions. Now a new prop,limitedGallery
is set based on both the DCDO parameter and whether the user has project validator permissions. If the user is a project validator, they always have access to the view more links. If they are not, the links are shown based on the value forlimited_gallery
set via DCDO.