core: 修复题目搜索页面面包屑无法点击的问题

This commit is contained in:
undefined committed 2021-03-14 12:38:27 +08:00
1 parent d662c55034
commit 2fe5d37c03
4 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.20.18",
"version": "2.20.19",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+1
View File
@@ -64,6 +64,7 @@ export class ProblemMainHandler extends ProblemHandler {
];
if (q) {
query.$text = { $search: q };
path[1][1] = 'problem_main';
path.push([q, null, null, true]);
}
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) query.hidden = false;
+3 -5
View File
@@ -7,7 +7,7 @@ import {
Pdoc, Ddoc, Drdoc, Tdoc, TrainingDoc, ProblemStatusDoc,
} from '../interface';
import { buildProjection } from '../utils';
import { NumberKeys, ArrayKeys, Projection } from '../typeutils';
import { NumberKeys, ArrayKeys, Projection, MaybeArray } from '../typeutils';
import db from '../service/db';
import * as bus from '../service/bus';
import { Content } from '../loader';
@@ -202,7 +202,7 @@ export async function pull<K extends keyof DocType, T extends ArrayKeys<DocType[
export async function deleteSub<T extends keyof DocType, K extends ArrayKeys<DocType[T]>>(
domainId: string, docType: T, docId: DocType[T]['docId'],
key: K, subId: DocType[T][K][0]['_id'] | DocType[T][K][0]['_id'][],
key: K, subId: MaybeArray<DocType[T][K][0]['_id']>,
): Promise<DocType[T]> {
subId = (subId instanceof Array) ? subId : [subId];
const res = await coll.findOneAndUpdate(
@@ -235,9 +235,7 @@ export async function setSub<T extends keyof DocType, K extends ArrayKeys<DocTyp
key: K, subId: DocType[T][K][0]['_id'], args: Partial<DocType[T][K][0]>,
): Promise<DocType[T]> {
const $set = {};
for (const k in args) {
$set[`${key}.$.${k}`] = args[k];
}
for (const k in args) $set[`${key}.$.${k}`] = args[k];
const res = await coll.findOneAndUpdate(
{
domainId,
+1
View File
@@ -10,3 +10,4 @@ export type Value<O, V = ''> = {
export type Projection<O> = (string & keyof O)[];
export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export type Filter<T, U> = T extends U ? T : never;
export type MaybeArray<T> = T | T[];