feat(users): support avatar, email and bgColor in fe

This commit is contained in:
hexxa 2022-03-20 17:47:15 +08:00 committed by Hexxa
parent 817ced61de
commit 95e5be092a
12 changed files with 36 additions and 3 deletions

View file

@ -20,6 +20,7 @@ export interface BgConfig {
repeat: string;
position: string;
align: string;
bgColor: string;
}
export interface Preferences {
@ -28,6 +29,8 @@ export interface Preferences {
lanPackURL: string;
lan: string;
theme: string;
avatar: string;
email: string;
}
export interface User {

View file

@ -17,11 +17,13 @@ export const resps = {
data: {
siteName: "",
siteDesc: "",
captchaEnabled: true,
bg: {
url: "clientCfg_bg_url",
repeat: "clientCfg_bg_repeat",
position: "clientCfg_bg_position",
align: "clientCfg_bg_align",
bgColor: "clientCfg_bg_bg_Color"
},
},
},

View file

@ -89,11 +89,14 @@ export const resps = {
repeat: "bgRepeat",
position: "bgPosition",
align: "bgAlign",
bgColor: "bgColor",
},
cssURL: "cssURL",
lanPackURL: "lanPackURL",
lan: "en_US",
theme: "light",
avatar: "avatar",
email: "email",
},
},
},

View file

@ -93,11 +93,14 @@ describe("Login", () => {
repeat: "bgRepeat",
position: "bgPosition",
align: "bgAlign",
bgColor: "bgColor",
},
cssURL: "cssURL",
lanPackURL: "lanPackURL",
lan: "en_US",
theme: "light",
avatar: "avatar",
email: "email",
},
});
@ -122,11 +125,13 @@ describe("Login", () => {
isVertical: false,
siteName: "",
siteDesc: "",
captchaEnabled: true,
bg: {
url: "clientCfg_bg_url",
repeat: "clientCfg_bg_repeat",
position: "clientCfg_bg_position",
align: "clientCfg_bg_align",
bgColor: "clientCfg_bg_bg_Color",
},
control: {
controls: Map<string, string>({

View file

@ -109,11 +109,14 @@ describe("State Manager", () => {
repeat: "bgRepeat",
position: "bgPosition",
align: "bgAlign",
bgColor: "bgColor",
},
cssURL: "cssURL",
lanPackURL: "lanPackURL",
lan: "en_US",
theme: "light",
avatar: "avatar",
email: "email",
},
});
@ -326,11 +329,14 @@ describe("State Manager", () => {
repeat: "",
position: "",
align: "",
bgColor: "",
},
cssURL: "",
lanPackURL: "",
lan: "en_US",
theme: "light",
avatar: "",
email: "",
},
});
@ -351,6 +357,7 @@ describe("State Manager", () => {
position: "clientCfg_bg_position",
repeat: "clientCfg_bg_repeat",
url: "clientCfg_bg_url",
bgColor: "clientCfg_bg_bg_Color",
});
});
});

View file

@ -139,11 +139,14 @@ describe("TopBar", () => {
repeat: "",
position: "",
align: "",
bgColor: "",
},
cssURL: "",
lanPackURL: "",
lan: "en_US",
theme: "light",
avatar: "",
email: "",
},
});

View file

@ -34,6 +34,7 @@ export interface UIProps {
repeat: string;
position: string;
align: string;
bgColor: string;
};
control: {
controls: Map<string, string>;
@ -103,11 +104,14 @@ export function initState(): ICoreState {
repeat: "",
position: "",
align: "",
bgColor: "",
},
cssURL: "",
lanPackURL: "",
lan: "en_US",
theme: "light",
avatar: "",
email: "",
},
},
msg: {
@ -123,6 +127,7 @@ export function initState(): ICoreState {
repeat: "",
position: "",
align: "",
bgColor: "",
},
captchaEnabled: true,
control: {

View file

@ -830,6 +830,7 @@ export class BgCfg extends React.Component<BgProps, BgState, {}> {
repeat: "repeat",
position: "center",
align: "fixed",
bgColor: "",
},
});
this.props.update(updater().updateUI);

View file

@ -618,11 +618,14 @@ export class Updater {
repeat: "",
position: "",
align: "",
bgColor: "",
},
cssURL: "",
lanPackURL: "",
lan: "en_US",
theme: "light",
avatar: "",
email: "",
};
};

View file

@ -80,9 +80,6 @@ func NewFileInfoStore(store kvstore.IKVStore) (*FileInfoStore, error) {
boltdb: boltdb,
mtx: &sync.RWMutex{},
}
if err = migrate(fi); err != nil {
return nil, err
}
return fi, nil
}

View file

@ -457,6 +457,8 @@ func TestUsersHandlers(t *testing.T) {
},
CSSURL: "/cssurl",
LanPackURL: "/lanpack",
Avatar: "a1",
Email: "email1",
},
&db.Preferences{
Bg: &sitestore.BgConfig{
@ -468,6 +470,8 @@ func TestUsersHandlers(t *testing.T) {
},
CSSURL: "/cssurl2",
LanPackURL: "/lanpack2",
Avatar: "a2",
Email: "email2",
},
}
for _, prefer := range prefers {

Binary file not shown.