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
Hide course versions #26678
Conversation
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.
👍 Looks good! The test updates along with this give me a lot of confidence in the change.
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.
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, |
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.
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, |
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.
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:
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.
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', () => { |
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.
Thank you for keeping these test case names up to date! 💯
Hide course/script versions in version dropdown on course/script overview pages if
can_view_version?(user)
is false.