mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
bug fixes
This commit is contained in:
12 files changed
+46
-35
No files matched your search
@@ -4,7 +4,7 @@ import moment from 'moment-timezone';
|
||||
import type { Context } from '../context';
|
||||
import {
|
||||
CannotDeleteSystemDomainError, DomainJoinAlreadyMemberError, DomainJoinForbiddenError, ForbiddenError,
|
||||
InvalidJoinInvitationCodeError, OnlyOwnerCanDeleteDomainError, PermissionError, RoleAlreadyExistError, ValidationError,
|
||||
InvalidJoinInvitationCodeError, NotFoundError, OnlyOwnerCanDeleteDomainError, PermissionError, RoleAlreadyExistError, ValidationError,
|
||||
} from '../error';
|
||||
import type { DomainDoc } from '../interface';
|
||||
import avatar from '../lib/avatar';
|
||||
@@ -337,6 +337,7 @@ class DomainJoinHandler extends Handler {
|
||||
domain.get(target),
|
||||
domain.collUser.findOne({ domainId: target, uid: this.user._id }),
|
||||
]);
|
||||
if (!dudoc) throw new NotFoundError(target);
|
||||
const assignedRole = this.user.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN)
|
||||
? 'root'
|
||||
: dudoc?.role || 'default';
|
||||
|
||||
@@ -198,7 +198,11 @@ class SystemConfigHandler extends SystemHandler {
|
||||
};
|
||||
|
||||
try {
|
||||
value = Schema.intersect(this.ctx.config.settings)(yaml.load(this.ctx.config.configSource));
|
||||
try {
|
||||
value = Schema.intersect(this.ctx.config.settings)(yaml.load(this.ctx.config.configSource));
|
||||
} catch (e) {
|
||||
value = yaml.load(this.ctx.config.configSource);
|
||||
}
|
||||
for (const schema of this.ctx.config.settings) processNode(value, schema);
|
||||
} catch (e) { }
|
||||
this.response.body = {
|
||||
|
||||
@@ -139,16 +139,15 @@ export class ConfigService extends Service {
|
||||
});
|
||||
}
|
||||
let curValue = s(this.systemConfig);
|
||||
if (dynamic) {
|
||||
this.ctx.on('system/setting', () => {
|
||||
try {
|
||||
curValue = s(this.systemConfig);
|
||||
} catch (e) {
|
||||
logger.warn('Cannot read config: ', e.message);
|
||||
curValue = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!dynamic) return curValue;
|
||||
this.ctx.on('system/setting', () => {
|
||||
try {
|
||||
curValue = s(this.systemConfig);
|
||||
} catch (e) {
|
||||
logger.warn('Cannot read config: ', e.message);
|
||||
curValue = null;
|
||||
}
|
||||
});
|
||||
const that = this;
|
||||
const getAccess = (path: (string | symbol)[]) => {
|
||||
if (path.some((p) => ConfigService.blacklist.includes(p.toString()))) throw new Error('Invalid path');
|
||||
|
||||
Reference in new issue
Block a user