-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix program id retrieval when sharing #2061
Conversation
@@ -77,7 +77,7 @@ export class LearnerRecordsPage extends React.Component<Props, State> { | |||
} | |||
|
|||
getOnlyProgramId() { |
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.
What is the difference between getOnlyProgramId
and getProgramId
?
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 also had that question. I think the getOnlyProgramId does the same thing getProgramId without the check for return this.props.match.params.program.length !== 36
. But we should ask @jkachel for the meaning behind it.
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.
were you able to test "Allow Sharing" on the program records?
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.
Yes, this works for me. But that mystery "36" in the similar function should be figured out before approving.
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.
The URLs are the same if you're viewing for a program or a shared record. The shared records use a UUID, hence 36. Neither of these two functions are named particularly well; getProgramId
is really a check for a shared program record where getOnlyProgramId
only returns if there's a program ID (aka an int).
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.
Functionality works well but I think these two functions should be renamed to something more representative of what they do. These should only be used here so that should be a quick refactor.
7c9c539
to
1a9fcb8
Compare
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.
So I have a program with 2 required courses. I also have a program certificate. When I load the program record page I am seeing an error in the console and the program sharing buttons are not displayed. When I switch back to the main branch, this does not occur.
? this.props.match.params.program | ||
: false | ||
isProgramRecordShared() { | ||
return this.props.match.params.program.length === 36 |
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 would add a comment indicating what the 36 number is and how it's used.
c7d46ce
to
95c8cc4
Compare
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.
Very good!
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 👍
What are the relevant tickets?
Fix #2056
Description (What does it do?)
Fixes a bug when getting the program id.
How can this be tested?
Go to view your program record, click enable sharing, check that sharing request was called with the correct program id.