-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat: Adds discussions settings for new discusions experience [BD-38] [TNL-8621] [BB-4854] #28749
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
feat: Adds discussions settings for new discusions experience [BD-38] [TNL-8621] [BB-4854] #28749
Conversation
|
Thanks for the pull request, @xitij2000! I've created BLENDED-963 to keep track of it in Jira. More details are on the BD-38 project page. When this pull request is ready, tag your edX technical lead. |
66e4d95 to
92abd91
Compare
5b40d6f to
a4d3a19
Compare
|
jenkins run python |
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 will hide these new settings from the advanced settings UI.
Might be worth removing it from here while testing to have an easy way to check for changes.
cms/envs/common.py
Outdated
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.
Now that I've added a plugin entrypoint, this isn't needed any more.
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.
Moving these over allows us to import this in both LMS and studio code.
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 simply set the default here instead of in a dozen other places.
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 lets the standard machinery handle the regular fields and we can focus on the complex cases.
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 is a setting that specific to the inbuild forums, so it can be stored in the plugin configuraiton.
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 is direclty moved over.
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.
All this code is just moved over without any changes other than adding type hints.
Agrendalath
left a comment
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.
@xitij2000, I've tested that the changes are persisted when I'm setting them through the advanced settings. From your first point, it looks that we should also test this with the frontend-app-course-authoring, right? When I'm visiting the discussions settings, I'm getting the following error:
TypeError
can't access property "map", basic is undefined
Call Stack
FeaturesTable
src/pages-and-resources/discussions/app-list/FeaturesTable.jsx:96:12
renderWithHooks
node_modules/react-dom/cjs/react-dom.development.js:14803:27
mountIndeterminateComponent
node_modules/react-dom/cjs/react-dom.development.js:17482:13
beginWork
node_modules/react-dom/cjs/react-dom.development.js:18596:16
callCallback
node_modules/react-dom/cjs/react-dom.development.js:188:14
invokeGuardedCallbackDev
node_modules/react-dom/cjs/react-dom.development.js:237:16
invokeGuardedCallback
node_modules/react-dom/cjs/react-dom.development.js:292:31
beginWork$1
node_modules/react-dom/cjs/react-dom.development.js:23203:28
performUnitOfWork
node_modules/react-dom/cjs/react-dom.development.js:22154:12
workLoopSync
node_modules/react-dom/cjs/react-dom.development.js:22130:22
openedx/core/djangoapps/discussions/docs/decisions/0004-in-context-discussions-linking.rst
Outdated
Show resolved
Hide resolved
4a92c14 to
2699f07
Compare
Agrendalath
left a comment
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 tested this: verified that the course settings are applied correctly through the MFE
- I read through the code
- I checked for accessibility issues: n/a
- Includes documentation
- I made sure any change in configuration variables is reflected in the corresponding client's
configuration-securerepository: n/a
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 know it doesn't load the course every time, but let's make it simpler and store that value in a variable course = self._get_course() to make it more readable.
after refactor this would becomecourse. discussions_settings[key] = value
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 can do that but in that case every call to this API will load the course, even if it doesn't need to.
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.
Can you explain how it would be any different in loading the course with respect to storing it in var and using it and directly calling the get_course? Here is what I mean.
Approch 1:
self._get_course().discussions_settings[updated_provider_type] = value
self._get_course().discussions_settings[key] = value
Approch 2:
course = self._get_course()
course.discussions_settings[updated_provider_type] = value
course.discussions_settings[key] = value
...
modulestore().update_item(course, self.context['user_id'])
I found approach 2 more readable as we are updating the "same" course we have modified.
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.
Ah sure! I thought you meant loading it once up top and using that. Will update.
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.
Actually, on reading through the code again, I think the approach you've mentioned will cause a performance hit when the course doesn't need to be loaded. I'll explain why.
There are three places that self._get_course() is used:
- Line 336: Here, we only want the course to be loaded if there is a setting that has changed, which is what we're checking in the if condition above. That is why we call get course only if that condition applies.
- Line 342: Here once again we check if the configuration has changed, and if it has, we load the course and update the settings.
- Line 352: Here, we only want to load the course if the settings have changed. At this point the course has definitely been loaded,
The approach you've outlined above won't work because each access to the course object is happening in a different conditional, so before applying each change we'd need to check if course is None and then load it, which is exactly why that was moved to a method in the first place.
2699f07 to
c104fbd
Compare
9d717a5 to
ffc158c
Compare
This commit adds new discussions settings for the new discussions experience. These are stored in the course so they can be a part of course import/export flow. These are also added to the discussions configuraiton API to allow MFEs to update the settings. The discussions API is currently available via LMS, however that means it cannot save changes to the modulestore. This also adds the API to the studio config so it can now also be accessed from studio and be used to save course settings.
ffc158c to
98a9b8e
Compare
|
Your PR has finished running tests. There were no failures. |
awaisdar001
left a comment
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.
👍
|
@awaisdar001 This is good to merge on my side. |
|
I'll merge this in the morning. |
|
@xitij2000 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
1 similar comment
|
EdX Release Notice: This PR has been deployed to the production environment. |
Description
This commit adds new discussions settings for the new discussions experience. These are stored in the course so they can be a part of course import/export flow.
These are also added to the discussions configuration API to allow MFEs to update the settings.
Supporting information
Testing instructions
Deadline
"None"