Hiding the Anonymous Discussion Options in the Discussion Re-Design
![Community Coach Community Coach](https://community.canvaslms.com/html/@70547A9FEA033443EB1FB5B5E3C1FBC2/rank_icons/inst_coach_logo.png)
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
With the enforcement of the Discussion Re-design coming this summer, we have already transitioned to using it to avoid disruptions mid-semester. We are looking forward to the checkpoints feature that will be coming soon and some of the other new features like being able to view edit history.
However, we are not ready to support the anonymous discussion feature that is now included since it also hides the identity of the student from the teacher(s) and admins. We will re-evaluate this in the future as this evolves, but for now we are restricting the ease of access to this feature. Since we saw other community members express similar concerns about this feature, we wanted to share the code we are currently using to hide and remove the anonymous discussion options from the UI.
The following CSS is used to hide the heading and options from view*:
div#discussion-edit-view
div#discussion-details-tab
div.controls
h4#anonymous_section_header {
display: none;
}
div#discussion-edit-view
div#discussion-details-tab
div.controls
h4#anonymous_section_header
+ div {
display: none;
}
The following JavaScript is used to remove the anonymous discussion options and header*:
(() => {
if (
/\/courses\/[0-9]+\/discussion_topics\/[0-9]+\/edit/.test(
window.location.pathname
) ||
/\/courses\/[0-9]+\/discussion_topics\/new/.test(window.location.pathname)
) {
window.addEventListener("load", () => {
removeAnonymousOptions();
});
}
function removeAnonymousOptions() {
const anonymousOptionsDiv = document.querySelector(
"div#discussion-details-tab div.controls h4#anonymous_section_header + div"
);
anonymousOptionsDiv?.remove();
const anonymousOptionsHeader = document.querySelector(
"div#discussion-details-tab div.controls h4#anonymous_section_header"
);
anonymousOptionsHeader?.remove();
}
})();
If you have any feedback about the code, please let me know 😀 Thank you @robotcars for your initial feedback!
*Please note that this code is provided as is and without warranty of any kind. It may stop working in the future and may require updates as new updates are released to the Canvas UI. Always evaluate code and test it for yourself before deploying it in your production environment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.