Skip to content
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

Merged
merged 4 commits into from Sep 6, 2018

Conversation

Erin007
Copy link
Contributor

@Erin007 Erin007 commented Sep 5, 2018

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 for limited_gallery set via DCDO.

// 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']
Copy link
Contributor

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?

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

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

@Erin007
Copy link
Contributor Author

Erin007 commented Sep 6, 2018

@islemaster What do you think about the updates? Any other requested changes?

@islemaster
Copy link
Contributor

👀

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

🎉 LGTM!

@Erin007 Erin007 merged commit 7f9cc55 into staging Sep 6, 2018
@Erin007 Erin007 deleted the use-dcdo-to-hide-projects branch September 6, 2018 19:11
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.

None yet

2 participants