-
Notifications
You must be signed in to change notification settings - Fork 313
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
Allow course sharing name to be changed #9860
Allow course sharing name to be changed #9860
Conversation
Delete apps/prairielearn/src/pages/instructorCourseAdminSharing/FunctionalityToAdd.md
…el-Holmes-SDE/PrairieLearn into course-sharing-name-change
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have reviewed and hereby sign the CLA |
recheck |
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.
One UI comment; other than that, you'll need to run our formatter on this code. You can either rely on the extensions/settings in the .vscode
directory if you're using VS Code, or manually run make format-js
if you're not.
<p><strong>Once you choose your course's sharing name, you may not be able to change it</strong>, | ||
because doing so would break the assessments of other courses that have imported your questions. | ||
<strong>If you have not yet shared any questions publicly or with other courses, you may edit your course's sharing name.</strong> |
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.
We should be able to figure out whether or not renaming is allowed at the instant the page is loaded and update the UI to say concretely "you can/cannot rename this" and disable buttons/etc. appropriately.
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.
@Michael-Holmes-SDE we talked about this in our developer meeting and decided that the easiest thing to do is this: The 'Choose sharing name' button on the page should always be enabled.
If you click on it and you are allowed to change it, the dialog you see should say that you will be allowed to edit it until you share questions.
If you click on it and you are not allowed to change it, the dialog should say that you cannot change the sharing name, because you already have shared questions--and then the dialog should not have the 'choose sharing name' button on it, just the close button to close the dialog.
Thanks for your hard work @Michael-Holmes-SDE this is a great start! As Nathan said, you'll need to get the code formatters working, and you should have the button enabled/disabled based on whether they are allowed to edit. The other thing you'll need to do (I can't remember if I told you this before or not, sorry) is to add some automated tests verifying that the functionality works. The automated tests for this page are in You'll want to have one test where you can successfully change the name if nothing has been shared yet, probably around here: PrairieLearn/apps/prairielearn/src/tests/questionSharing.test.ts Lines 189 to 210 in 1b3268b
and they you'll want another test where it fails to change the name if they have already shared something, probably after this code: PrairieLearn/apps/prairielearn/src/tests/questionSharing.test.ts Lines 350 to 376 in 1b3268b
see the docs about running tests here: https://prairielearn.readthedocs.io/en/latest/installingLocal/#running-the-test-suite You only need to worry about running this one test file ( |
…el-Holmes-SDE/PrairieLearn into course-sharing-name-change
…uestion has not been shared and when one has
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9860 +/- ##
==========================================
+ Coverage 66.78% 66.97% +0.19%
==========================================
Files 454 456 +2
Lines 71046 71307 +261
Branches 5679 5714 +35
==========================================
+ Hits 47446 47760 +314
+ Misses 23175 23120 -55
- Partials 425 427 +2 ☔ View full report in Codecov by Sentry. |
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.
We could use some more types here, and I'd rather use our Modal
component instead of handcrafting one, but this isn't directly related to this PR. I'll open a followup to fix these things.
apps/prairielearn/src/pages/instructorCourseAdminSharing/instructorCourseAdminSharing.html.ts
Outdated
Show resolved
Hide resolved
<input type="hidden" name="__action" value="choose_sharing_name"> | ||
<input type="hidden" name="__csrf_token" value="${resLocals.__csrf_token}"> | ||
<div class=form-group> | ||
<input class="form-control form-control-sm" type="text" name="course_sharing_name" required/> |
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.
This input lacks an accessible label. I know this is not a change in this PR, but I'd very much appreciate adding one. IMO we also don't need to use form-control-sm
here.
I also don't think this should go in the footer, or be right-aligned. Let's move this input under the "Enter the sharing name you would like..." text.
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.
apps/prairielearn/src/pages/instructorCourseAdminSharing/instructorCourseAdminSharing.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Nathan Sarang-Walters <nwalters512@gmail.com>
@nwalters512 is there an easy way to auto-approve the CI build for all PRs from @Michael-Holmes-SDE? I don't want to have to keep hitting 'approve' over and over again. |
@SethPoulsen once he lands any PR, including this one, all future CI runs will happen automatically. |
This pull request allows the 'Course Sharing Name' to be changed, as long as the course has no publicly shared questions and no questions have been imported from the current course
implements part of #7895