mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: fix typo
This commit is contained in:
8 files changed
+11
-11
No files matched your search
@@ -12,7 +12,7 @@ export const PERM = {
|
||||
// Domain Settings
|
||||
PERM_VIEW: 1n << 0n,
|
||||
PERM_EDIT_DOMAIN: 1n << 1n,
|
||||
PREM_VIEW_DISPLAYNAME: 1n << 67n,
|
||||
PERM_VIEW_DISPLAYNAME: 1n << 67n,
|
||||
PERM_MOD_BADGE: 1n << 2n,
|
||||
|
||||
// Problem
|
||||
@@ -104,7 +104,7 @@ export const Permission = (family: string, key: BigInt, desc: string) => ({ fami
|
||||
|
||||
export const PERMS = [
|
||||
Permission('perm_general', PERM.PERM_VIEW, 'View this domain'),
|
||||
Permission('perm_general', PERM.PREM_VIEW_DISPLAYNAME, 'View domain user displayname'),
|
||||
Permission('perm_general', PERM.PERM_VIEW_DISPLAYNAME, 'View domain user displayname'),
|
||||
Permission('perm_general', PERM.PERM_EDIT_DOMAIN, 'Edit domain settings'),
|
||||
Permission('perm_general', PERM.PERM_MOD_BADGE, 'Show MOD badge'),
|
||||
Permission('perm_problem', PERM.PERM_CREATE_PROBLEM, 'Create problems'),
|
||||
@@ -188,7 +188,7 @@ PERM.PERM_BASIC = PERM.PERM_VIEW
|
||||
| PERM.PERM_VIEW_RANKING;
|
||||
|
||||
PERM.PERM_DEFAULT = PERM.PERM_VIEW
|
||||
| PERM.PREM_VIEW_DISPLAYNAME
|
||||
| PERM.PERM_VIEW_DISPLAYNAME
|
||||
| PERM.PERM_VIEW_PROBLEM
|
||||
| PERM.PERM_EDIT_PROBLEM_SELF
|
||||
| PERM.PERM_SUBMIT_PROBLEM
|
||||
|
||||
@@ -16,7 +16,7 @@ export default (router, logger) => async (ctx: KoaContext, next) => {
|
||||
};
|
||||
const engine = global.Hydro.lib.template?.render
|
||||
|| (() => JSON.stringify(args, serializer({
|
||||
showDisplayName: user?.hasPerm(PERM.PREM_VIEW_DISPLAYNAME),
|
||||
showDisplayName: user?.hasPerm(PERM.PERM_VIEW_DISPLAYNAME),
|
||||
})));
|
||||
return engine(templateName, {
|
||||
handler: ctx.handler,
|
||||
|
||||
@@ -27,7 +27,7 @@ export default (logger) => async (ctx: KoaContext, next) => {
|
||||
response.body.UiContext = UiContext;
|
||||
response.body.UserContext = user;
|
||||
}
|
||||
response.body = JSON.stringify(response.body, serializer({ showDisplayName: user?.hasPerm(PERM.PREM_VIEW_DISPLAYNAME) }));
|
||||
response.body = JSON.stringify(response.body, serializer({ showDisplayName: user?.hasPerm(PERM.PERM_VIEW_DISPLAYNAME) }));
|
||||
} catch (e) {
|
||||
response.body = new SystemError('Serialize failure', e.message);
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ export class ConnectionHandler extends HandlerCommon {
|
||||
|
||||
send(data: any) {
|
||||
this.conn.send(JSON.stringify(data, serializer({
|
||||
showDisplayName: this.user?.hasPerm(PERM.PREM_VIEW_DISPLAYNAME),
|
||||
showDisplayName: this.user?.hasPerm(PERM.PERM_VIEW_DISPLAYNAME),
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
@@ -436,7 +436,7 @@ const scripts: UpgradeScript[] = [
|
||||
return await iterateAllDomain(async (ddoc) => {
|
||||
for (const role of Object.keys(ddoc.roles)) {
|
||||
if (['guest', 'root'].includes(role)) return;
|
||||
ddoc.roles[role] = (BigInt(ddoc.roles[role]) | PERM.PREM_VIEW_DISPLAYNAME).toString();
|
||||
ddoc.roles[role] = (BigInt(ddoc.roles[role]) | PERM.PERM_VIEW_DISPLAYNAME).toString();
|
||||
}
|
||||
await domain.setRoles(ddoc._id, ddoc.roles);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user