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

Hide course versions #26678

Merged
merged 13 commits into from Jan 23, 2019
Merged

Hide course versions #26678

merged 13 commits into from Jan 23, 2019

Conversation

maddiedierker
Copy link
Contributor

@maddiedierker maddiedierker commented Jan 22, 2019

Hide course/script versions in version dropdown on course/script overview pages if can_view_version?(user) is false.

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.

👍 Looks good! The test updates along with this give me a lot of confidence in the change.

Copy link
Member

@davidsbailey davidsbailey left a comment

Choose a reason for hiding this comment

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

Great work Maddie! Please let me know if you'd like me to look again, otherwise this looks good to merge after addressing comments.

@@ -69,7 +69,8 @@ export default class CourseOverview extends Component {
hasVerifiedResources: PropTypes.bool.isRequired,
versions: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
version_year: PropTypes.string.isRequired
version_year: PropTypes.string.isRequired,
can_view_version: PropTypes.bool.isRequired,
Copy link
Member

Choose a reason for hiding this comment

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

while you are in here, please add version_title as a required part of this shape, because it is depended on below.

@@ -74,6 +74,7 @@ class ScriptOverviewHeader extends Component {
name: PropTypes.string.isRequired,
version_year: PropTypes.string.isRequired,
version_title: PropTypes.string.isRequired,
can_view_version: PropTypes.bool.isRequired,
Copy link
Member

Choose a reason for hiding this comment

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

I am going to suggest that you extract a scriptVersionShape, shared between here and ScriptOverview. A scriptVersionShape would contain all the information needed to display a row in the version dropdown on the script overview page. This will help make it clear that this PropType is distinct from the similar-but-different assignmentVersionShape.

I'm also going to recommend that you do not (yet) share this shape with the CourseOverview. This is because course versions and script versions are generated in different places (see two summarize_versions methods), and we do want to create a hard dependency between these implementations.

It may sound like I'm going off the deep end here re: not over-deduplicating. I blame these articles:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't think you're going off the deep end! this is a good thing to DRY up

@@ -143,9 +143,10 @@ describe('CourseOverview', () => {
expect(utils.navigateToHref).to.have.been.calledOnce;
});

it('does not appear when only one version is present', () => {
it('does not appear when only one version is viewable', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for keeping these test case names up to date! 💯

@maddiedierker maddiedierker merged commit b98b089 into staging Jan 23, 2019
@maddiedierker maddiedierker deleted the hide-course-versions branch January 23, 2019 06:36
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

3 participants