mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: change domain.union to namespaces
This commit is contained in:
7 files changed
+46
-90
No files matched your search
@@ -347,25 +347,22 @@ class UserDetailHandler extends Handler {
|
||||
async get(domainId: string, uid: number) {
|
||||
if (uid === 0) throw new UserNotFoundError(0);
|
||||
const isSelfProfile = this.user._id === uid;
|
||||
const [udoc, sdoc, union] = await Promise.all([
|
||||
const [udoc, sdoc] = await Promise.all([
|
||||
user.getById(domainId, uid),
|
||||
token.getMostRecentSessionByUid(uid, ['createAt', 'updateAt']),
|
||||
domain.get(domainId),
|
||||
]);
|
||||
if (!udoc) throw new UserNotFoundError(uid);
|
||||
const pdocs: ProblemDoc[] = [];
|
||||
const acInfo: Record<string, number> = {};
|
||||
const canViewHidden = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id;
|
||||
if (this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) {
|
||||
await Promise.all([domainId, ...(union?.union || [])].map(async (did) => {
|
||||
const psdocs = await problem.getMultiStatus(did, { uid, status: STATUS.STATUS_ACCEPTED }).toArray();
|
||||
pdocs.push(...Object.values(
|
||||
await problem.getList(
|
||||
did, psdocs.map((i) => i.docId), canViewHidden,
|
||||
false, problem.PROJECTION_LIST, true,
|
||||
),
|
||||
));
|
||||
}));
|
||||
const psdocs = await problem.getMultiStatus(domainId, { uid, status: STATUS.STATUS_ACCEPTED }).toArray();
|
||||
pdocs.push(...Object.values(
|
||||
await problem.getList(
|
||||
domainId, psdocs.map((i) => i.docId), canViewHidden,
|
||||
false, problem.PROJECTION_LIST, true,
|
||||
),
|
||||
));
|
||||
}
|
||||
for (const pdoc of pdocs) {
|
||||
for (const tag of pdoc.tag) {
|
||||
|
||||
Reference in new issue
Block a user