Skip to content
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

SAK-50095 Discussion topic linking to GB automatically checks the box to add a task #13261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kunaljaykam
Copy link
Member

No description provided.

@ern ern changed the title SAK-50095 Discussion Topic Linking to GB automatically checks the box to add task in Dashboard Tasks widget SAK-50095 Discussion topic linking to GB automatically checks the box to add a task Jan 31, 2025
Copy link
Contributor

@adrianfish adrianfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of questions

@@ -47,7 +47,8 @@
var elems = document.getElementsByTagName('sakai-rubric-association');
var forumAssignments = document.getElementById("revise:forum_assignments");
const createTaskGroup = document.getElementById("revise:createTaskGroup");
if (forumAssignments?.value && forumAssignments.value !== "Default_0") {
const isTasksWidgetAvailable = !!document.querySelector("sakai-tasks");
if (forumAssignments?.value && forumAssignments.value !== "Default_0" && isTasksWidgetAvailable) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can forumAssignments be nullish here? If so, it may just make sense to return at the top of the method instead of using these if blocks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about forumAssignments? That operator is checking for null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If forumAssigments is crucial in this block of code, then why not exit the method early so no more dom queries have to happen. It would make the code clearer too, probably. Also, you can directly compare the optional chaining output using !==. undefined is a primitive so can be used in the equality statements.

if (topicAssignments?.value && topicAssignments.value !== "Default_0") {
const isTasksWidgetAvailable = !!document.querySelector("sakai-tasks");

if (topicAssignments?.value && topicAssignments.value !== "Default_0" && isTasksWidgetAvailable) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here, about topicAssignments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants