feat: add database migration scripts and supplementary tooling for data imports and site management

This commit is contained in:
2026-05-26 14:17:05 +02:00
parent dd4e56c8fb
commit ef3a9bd3b0

View File

@@ -3023,16 +3023,29 @@ class CommentSystem {
} }
if (!this.lastData) this.lastData = []; if (!this.lastData) this.lastData = [];
if (this.sort === 'new') this.lastData.unshift(newComment); const existingInLastData = this.lastData.find(c => c.id === newComment.id);
else this.lastData.push(newComment); if (existingInLastData) {
existingInLastData.files = files;
} else {
if (this.sort === 'new') this.lastData.unshift(newComment);
else this.lastData.push(newComment);
}
if (parentId) { if (parentId) {
const existingReply = document.getElementById('c' + newComment.id); const existingReply = document.getElementById('c' + newComment.id);
if (existingReply) { if (existingReply) {
requestAnimationFrame(() => { const parent = existingReply.parentNode;
existingReply.classList.add('comment-entering', 'new-item-fade'); const commentHtml = this.renderComment(existingInLastData || newComment, this.lastUserId, true);
existingReply.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); const tmp = document.createElement('div');
}); tmp.innerHTML = commentHtml;
const newEl = tmp.firstElementChild;
if (newEl) {
parent.replaceChild(newEl, existingReply);
requestAnimationFrame(() => {
newEl.classList.add('comment-entering', 'new-item-fade');
newEl.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
});
}
} else { } else {
const parentEl = document.getElementById('c' + parentId); const parentEl = document.getElementById('c' + parentId);
if (parentEl) { if (parentEl) {
@@ -3059,10 +3072,18 @@ class CommentSystem {
} else { } else {
const existingTop = document.getElementById('c' + newComment.id); const existingTop = document.getElementById('c' + newComment.id);
if (existingTop) { if (existingTop) {
requestAnimationFrame(() => { const parent = existingTop.parentNode;
existingTop.classList.add('comment-entering', 'new-item-fade'); const commentHtml = this.renderComment(existingInLastData || newComment, this.lastUserId, false);
existingTop.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); const tmp = document.createElement('div');
}); tmp.innerHTML = commentHtml;
const newEl = tmp.firstElementChild;
if (newEl) {
parent.replaceChild(newEl, existingTop);
requestAnimationFrame(() => {
newEl.classList.add('comment-entering', 'new-item-fade');
newEl.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
});
}
} else { } else {
const list = this.container.querySelector('.comments-list'); const list = this.container.querySelector('.comments-list');
if (list) { if (list) {