core&ui: bug fix

This commit is contained in:
undefined committed 2021-09-25 21:47:05 +08:00
1 parent 42f41c4f61
commit e4c2f309c4
6 files changed
+9 -26

No files matched your search

+1 -18
View File
@@ -224,16 +224,11 @@ function set(s: Setting, key: string, value: any) {
class HomeSettingsHandler extends Handler {
@param('category', Types.Name)
async get(domainId: string, category: string) {
const path = [
['Hydro', 'homepage'],
[`home_${category}`, null],
];
this.response.template = 'home_settings.html';
this.response.body = {
category,
page_name: `home_${category}`,
current: this.user,
path,
};
if (category === 'preference') {
this.response.body.settings = setting.PREFERENCE_SETTINGS;
@@ -281,10 +276,6 @@ class UserChangemailWithCodeHandler extends Handler {
class HomeDomainHandler extends Handler {
async get() {
const path = [
['Hydro', 'homepage'],
['home_domain', null],
];
let ddocs: DomainDoc[] = [];
let dudict: Record<string, DomainDoc> = {};
if (!this.user.hasPriv(PRIV.PRIV_VIEW_ALL_DOMAIN)) {
@@ -310,20 +301,12 @@ class HomeDomainHandler extends Handler {
|| udoc.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
}
this.response.template = 'home_domain.html';
this.response.body = {
ddocs, dudict, canManage, path,
};
this.response.body = { ddocs, dudict, canManage };
}
}
class HomeDomainCreateHandler extends Handler {
async get() {
this.response.body = {
path: [
['Hydro', 'homepage'],
['domain_create', null],
],
};
this.response.template = 'domain_create.html';
}
+1 -1
View File
@@ -206,7 +206,7 @@ class UserModel {
@ArgMethod
static async setById(uid: number, $set?: Partial<Udoc>, $unset?: Value<Partial<Udoc>, ''>) {
if (uid < 1000) return null;
if (uid < -999) return null;
const op: any = {};
if ($set && Object.keys($set).length) op.$set = $set;
if ($unset && Object.keys($unset).length) op.$unset = $unset;