-
-
Notifications
You must be signed in to change notification settings - Fork 956
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
base: master
Are you sure you want to change the base?
Conversation
… to add task in Dashboard Tasks widget
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.
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) { |
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 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.
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 about forumAssignments?
That operator is checking for null
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.
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) { |
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.
Same question here, about topicAssignments
No description provided.