fix: properly create webmentions section before appending type sections
When no build-time webmentions exist, the first type to be processed was silently dropped because createWebmentionsSection() only creates the wrapper, not the type-specific section. After calling it, the code tried to find the selector which still didn't exist. Fixed by: create wrapper if needed, then always append the section to the wrapper and get the row/list from the newly created section.
This commit is contained in:
+15
-12
@@ -86,13 +86,14 @@
|
|||||||
// Create section if it doesn't exist
|
// Create section if it doesn't exist
|
||||||
if (!row) {
|
if (!row) {
|
||||||
const section = createAvatarSection(type);
|
const section = createAvatarSection(type);
|
||||||
const webmentionsSection = document.getElementById('webmentions');
|
let webmentionsSection = document.getElementById('webmentions');
|
||||||
|
if (!webmentionsSection) {
|
||||||
|
createWebmentionsSection();
|
||||||
|
webmentionsSection = document.getElementById('webmentions');
|
||||||
|
}
|
||||||
if (webmentionsSection) {
|
if (webmentionsSection) {
|
||||||
webmentionsSection.appendChild(section);
|
webmentionsSection.appendChild(section);
|
||||||
row = section.querySelector('.avatar-row');
|
row = section.querySelector('.avatar-row');
|
||||||
} else {
|
|
||||||
createWebmentionsSection();
|
|
||||||
row = document.querySelector(selector);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,13 +127,14 @@
|
|||||||
// Create section if it doesn't exist
|
// Create section if it doesn't exist
|
||||||
if (!list) {
|
if (!list) {
|
||||||
const section = createReplySection();
|
const section = createReplySection();
|
||||||
const webmentionsSection = document.getElementById('webmentions');
|
let webmentionsSection = document.getElementById('webmentions');
|
||||||
|
if (!webmentionsSection) {
|
||||||
|
createWebmentionsSection();
|
||||||
|
webmentionsSection = document.getElementById('webmentions');
|
||||||
|
}
|
||||||
if (webmentionsSection) {
|
if (webmentionsSection) {
|
||||||
webmentionsSection.appendChild(section);
|
webmentionsSection.appendChild(section);
|
||||||
list = section.querySelector('ul');
|
list = section.querySelector('ul');
|
||||||
} else {
|
|
||||||
createWebmentionsSection();
|
|
||||||
list = document.querySelector(selector);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,13 +222,14 @@
|
|||||||
|
|
||||||
if (!list) {
|
if (!list) {
|
||||||
const section = createMentionSection();
|
const section = createMentionSection();
|
||||||
const webmentionsSection = document.getElementById('webmentions');
|
let webmentionsSection = document.getElementById('webmentions');
|
||||||
|
if (!webmentionsSection) {
|
||||||
|
createWebmentionsSection();
|
||||||
|
webmentionsSection = document.getElementById('webmentions');
|
||||||
|
}
|
||||||
if (webmentionsSection) {
|
if (webmentionsSection) {
|
||||||
webmentionsSection.appendChild(section);
|
webmentionsSection.appendChild(section);
|
||||||
list = section.querySelector('ul');
|
list = section.querySelector('ul');
|
||||||
} else {
|
|
||||||
createWebmentionsSection();
|
|
||||||
list = document.querySelector(selector);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user