mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix document.status unique key
This commit is contained in:
1 parent
08585bd3e9
commit
b4d77d3a2a
5 files changed
+16
-4
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.29.41",
|
"version": "2.29.42",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ export async function revSetStatus<T extends keyof DocStatusType>(
|
|||||||
|
|
||||||
async function ensureIndexes() {
|
async function ensureIndexes() {
|
||||||
const ic = coll.createIndex.bind(coll);
|
const ic = coll.createIndex.bind(coll);
|
||||||
const is = collStatus.createIndex.bind(coll);
|
const is = collStatus.createIndex.bind(collStatus);
|
||||||
const u = { unique: true };
|
const u = { unique: true };
|
||||||
const s = { sparse: true };
|
const s = { sparse: true };
|
||||||
await ic({ domainId: 1, docType: 1, docId: 1 }, u);
|
await ic({ domainId: 1, docType: 1, docId: 1 }, u);
|
||||||
|
|||||||
@@ -402,6 +402,18 @@ const scripts: UpgradeScript[] = [
|
|||||||
await RecordModel.coll.updateMany({}, { $unset: { effective: '' } });
|
await RecordModel.coll.updateMany({}, { $unset: { effective: '' } });
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
async function _36_37() {
|
||||||
|
const _FRESH_INSTALL_IGNORE = 1;
|
||||||
|
const cur = document.collStatus.find();
|
||||||
|
while (await cur.hasNext()) {
|
||||||
|
const doc = await cur.next();
|
||||||
|
await document.collStatus.deleteMany({
|
||||||
|
...pick(doc, ['docId', 'domainId', 'uid', 'docType']),
|
||||||
|
_id: { $gt: doc._id },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default scripts;
|
export default scripts;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.13.3",
|
"version": "4.13.4",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<span class="icon icon-award"></span> {{ _('View Contest') }}
|
<span class="icon icon-award"></span> {{ _('View Contest') }}
|
||||||
</a></li>
|
</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not attended and not model.contest.isDone(tdoc) %}
|
{% if not (attended or tdoc.attended) and not model.contest.isDone(tdoc) %}
|
||||||
<li class="menu__item">
|
<li class="menu__item">
|
||||||
{% if handler.user.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
|
{% if handler.user.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
|
||||||
<form action="{{ url('contest_detail', tid=tdoc.docId) }}" method="POST">
|
<form action="{{ url('contest_detail', tid=tdoc.docId) }}" method="POST">
|
||||||
|
|||||||
Reference in new issue
Block a user