-
Notifications
You must be signed in to change notification settings - Fork 6
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
hotfix: remove empty decisions from document on save #393
Conversation
app/controllers/agendapoints/edit.js
Outdated
const body = parsedHtml.body.childNodes; | ||
|
||
for (const child of body) { | ||
if (child.attributes?.typeof?.textContent.includes('besluit:Besluit')) { |
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 would check for both the prefixed and full URI here.
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.
@nvdk please let me know if new commit address your concern ?
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.
Works as expected. When removing all content of a decision (but keeping its div) it is correctly removed.
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 only checks the top level children of the document. What if the div in question is further down the tree?
As we mentioned in the standup, there is https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll which will probably be useful here
* hotfix: remove empty decisions from document on save * add check for both the prefixed and full URI * use querySelectorAll in removeEmptyDivs Co-authored-by: Elena Poelman <[email protected]> Co-authored-by: Arne Bertrand <[email protected]> (cherry picked from commit c80445d)
In order to prevent users from being able to create “faulty” documents by copy pasting etc, we would remove decisions that don’t have any content from the document when saving.