chore: add ignore version upgrade setting (#1491)

This commit is contained in:
boojack
2023-04-08 18:13:51 +08:00
committed by GitHub
parent ab867b68d3
commit 3eac19d258
9 changed files with 43 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import "@/less/settings/system-section.less";
interface State {
dbSize: number;
allowSignUp: boolean;
ignoreUpgrade: boolean;
disablePublicMemos: boolean;
additionalStyle: string;
additionalScript: string;
@ -31,6 +32,7 @@ const SystemSection = () => {
const [state, setState] = useState<State>({
dbSize: systemStatus.dbSize,
allowSignUp: systemStatus.allowSignUp,
ignoreUpgrade: systemStatus.ignoreUpgrade,
additionalStyle: systemStatus.additionalStyle,
additionalScript: systemStatus.additionalScript,
disablePublicMemos: systemStatus.disablePublicMemos,
@ -75,6 +77,17 @@ const SystemSection = () => {
});
};
const handleIgnoreUpgradeChanged = async (value: boolean) => {
setState({
...state,
ignoreUpgrade: value,
});
await api.upsertSystemSetting({
name: "ignore-upgrade",
value: JSON.stringify(value),
});
};
const handleUpdateCustomizedProfileButtonClick = () => {
showUpdateCustomizedProfileDialog();
};
@ -189,6 +202,10 @@ const SystemSection = () => {
<span className="normal-text">{t("setting.system-section.allow-user-signup")}</span>
<Switch checked={state.allowSignUp} onChange={(event) => handleAllowSignUpChanged(event.target.checked)} />
</div>
<div className="form-label">
<span className="normal-text">Ignore version upgrade</span>
<Switch checked={state.ignoreUpgrade} onChange={(event) => handleIgnoreUpgradeChanged(event.target.checked)} />
</div>
<div className="form-label">
<span className="normal-text">{t("setting.system-section.disable-public-memos")}</span>
<Switch checked={state.disablePublicMemos} onChange={(event) => handleDisablePublicMemosChanged(event.target.checked)} />