core&ui: fix typo

This commit is contained in:
undefined committed 2023-12-16 20:50:26 +08:00
1 parent 8dda281262
commit cbbe817488
8 files changed
+11 -11

No files matched your search

+3 -3
View File
@@ -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);
}
+1 -1
View File
@@ -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),
})));
}
+1 -1
View File
@@ -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);
});
@@ -5,7 +5,7 @@
<img class="small user-profile-avatar v-center" loading="lazy" src="{{ avatarUrl(udoc.avatar|default('')) }}" width="20" height="20">
{% endif %}
<a class="user-profile-name" href="{{ url('user_detail', uid=udoc._id) }}">
{% if handler.user.hasPerm(perm.PREM_VIEW_DISPLAYNAME) and udoc.displayName and udoc.displayName != udoc.uname %}
{% if handler.user.hasPerm(perm.PERM_VIEW_DISPLAYNAME) and udoc.displayName and udoc.displayName != udoc.uname %}
{{ udoc.displayName }} ({{ udoc.uname }})
{% else %}
{{ udoc.uname }}
@@ -28,7 +28,7 @@
</td>
<td class="col--submit-by">
<a href="{{ url('user_detail', uid=rdoc.uid) }}">
{% if handler.user.hasPerm(perm.PREM_VIEW_DISPLAYNAME) and udoc.displayName %}
{% if handler.user.hasPerm(perm.PERM_VIEW_DISPLAYNAME) and udoc.displayName %}
{{ udoc.displayName }} ({{ udoc.uname }})
{% else %}
{{ udoc.uname }}
@@ -18,12 +18,12 @@
</li>
<ul class="enroll_user_menu">
{%- for uid, udoc in udict -%}
<li class="menu__item enroll_user_menu_item" data-uid="{{ uid }}" data-uname="{{ udoc.uname }}" {% if handler.user.hasPerm(perm.PREM_VIEW_DISPLAYNAME) and udoc.displayName %}data-displayname="{{ udoc.displayName }}"{% endif %}>
<li class="menu__item enroll_user_menu_item" data-uid="{{ uid }}" data-uname="{{ udoc.uname }}" {% if handler.user.hasPerm(perm.PERM_VIEW_DISPLAYNAME) and udoc.displayName %}data-displayname="{{ udoc.displayName }}"{% endif %}>
<a href="./{{ tdoc._id }}?uid={{ uid }}" class="menu__link{% if (handler.request.query.uid or handler.user._id) == uid %} active{% endif %}">
<span class="user-profile-link">
<img class="small user-profile-avatar v-center" loading="lazy" src="{{ avatarUrl(udoc.avatar|default('')) }}" width="20" height="20">
<span class="user-profile-name">
{% if handler.user.hasPerm(perm.PREM_VIEW_DISPLAYNAME) and udoc.displayName and udoc.displayName != udoc.uname %}
{% if handler.user.hasPerm(perm.PERM_VIEW_DISPLAYNAME) and udoc.displayName and udoc.displayName != udoc.uname %}
{{ udoc.displayName }} ({{ udoc.uname }})
{% else %}
{{ udoc.uname }}