Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/5727

Vanessa23a30f064947
diff --git a/app/src/config/account.ts b/app/src/config/account.ts
index 7bc62db29c..10f05cc9a3 100644
--- a/app/src/config/account.ts
+++ b/app/src/config/account.ts
@@ -4,6 +4,9 @@ import {Constants} from "../constants";
import {fetchPost} from "../util/fetch";
import {repos} from "./repos";
import {confirmDialog} from "../dialog/confirmDialog";
+import {needSubscribe} from "../util/needSubscribe";
+import {syncGuide} from "../sync/syncGuide";
+import {hasClosestByClassName} from "../protyle/util/hasClosest";
export const account = {
element: undefined as Element,
@@ -329,10 +332,7 @@ ${window.siyuan.languages.account8}`;
fetchPost("/api/setting/getCloudUser", {
token: data.data.token,
}, response => {
- window.siyuan.user = response.data;
- element.innerHTML = account.genHTML();
- account.bindEvent(element);
- account.onSetaccount();
+ account._afterLogin(response, element)
});
});
});
@@ -345,14 +345,30 @@ ${window.siyuan.languages.account8}`;
fetchPost("/api/setting/getCloudUser", {
token: response.data.token,
}, userResponse => {
- window.siyuan.user = userResponse.data;
- element.innerHTML = account.genHTML();
- account.bindEvent(element);
- account.onSetaccount();
+ account._afterLogin(userResponse, element)
});
});
});
},
+ _afterLogin(userResponse: IWebSocketData, element: Element) {
+ window.siyuan.user = userResponse.data;
+ if (element.classList.contains("account") && !needSubscribe("")) {
+ const dialogElement = hasClosestByClassName(element, "b3-dialog--open");
+ if (dialogElement) {
+ window.siyuan.dialogs.find((item) => {
+ if (item.element.isSameNode(dialogElement)) {
+ item.destroy();
+ return true;
+ }
+ });
+ syncGuide();
+ return;
+ }
+ }
+ element.innerHTML = account.genHTML();
+ account.bindEvent(element);
+ account.onSetaccount();
+ },
onSetaccount() {
if (repos.element) {
repos.element.innerHTML = "";