mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: delete related ddoc when deleting tdoc
This commit is contained in:
1 parent
c78fc82d5b
commit
4c6aeeb914
6 files changed
+26
-11
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.33.6",
|
||||
"version": "2.33.7",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -458,6 +458,7 @@ export async function del(domainId: string, tid: ObjectID, type: Type = document
|
||||
await Promise.all([
|
||||
document.deleteOne(domainId, type, tid),
|
||||
document.deleteMultiStatus(domainId, type, { docId: tid }),
|
||||
document.deleteMulti(domainId, document.TYPE_DISCUSSION, { parentType: type, parentId: tid }),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -458,6 +458,18 @@ const scripts: UpgradeScript[] = [
|
||||
);
|
||||
return true;
|
||||
},
|
||||
async function _41_42() {
|
||||
const _FRESH_INSTALL_IGNORE = 1;
|
||||
await iterateAllDomain(async (ddoc) => {
|
||||
const cursor = discussion.getMulti(ddoc._id, { parentType: document.TYPE_CONTEST });
|
||||
while (await cursor.hasNext()) {
|
||||
const doc = await cursor.next();
|
||||
const tdoc = await document.coll.findOne({ docType: doc.parentType, docId: doc.parentId });
|
||||
if (!tdoc) await discussion.del(ddoc._id, doc.docId);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
},
|
||||
];
|
||||
|
||||
export default scripts;
|
||||
@@ -172,14 +172,16 @@ const getHash = (i) => {
|
||||
const getUrl = (files) => files.map((i) => `/${i}?${getHash(i)}`);
|
||||
|
||||
bus.on('app/started', () => {
|
||||
const files = readdirSync(join(tmpdir(), 'hydro', 'public'));
|
||||
const pages = files.filter((file) => file.endsWith('.page.js'));
|
||||
const themes = files.filter((file) => file.endsWith('.theme.js'));
|
||||
UiContextBase.extraPages = getUrl(pages);
|
||||
UiContextBase.themes = {};
|
||||
for (const theme of themes) {
|
||||
UiContextBase.themes[theme] = `/${theme}?${getHash(theme)}`;
|
||||
}
|
||||
setTimeout(() => {
|
||||
const files = readdirSync(join(tmpdir(), 'hydro', 'public'));
|
||||
const pages = files.filter((file) => file.endsWith('.page.js'));
|
||||
const themes = files.filter((file) => file.endsWith('.theme.js'));
|
||||
UiContextBase.extraPages = getUrl(pages);
|
||||
UiContextBase.themes = {};
|
||||
for (const theme of themes) {
|
||||
UiContextBase.themes[theme] = `/${theme}?${getHash(theme)}`;
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
global.Hydro.handler.ui = async () => {
|
||||
|
||||
@@ -311,7 +311,7 @@ h1, h2, h3, h4, h5, h6
|
||||
list-style: decimal
|
||||
margin-left: 1.9em
|
||||
|
||||
.typo li ul, .typo li ol
|
||||
.typo li ol
|
||||
margin-top: 1.2em
|
||||
margin-bottom: 1.2em
|
||||
margin-left: 2em
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.18.2",
|
||||
"version": "4.18.3",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user