This commit is contained in:
Mateusz Gruszczyński committed 2026-10-16 22:49:22 +02:00
1 parent 4da41a1404
commit 5cb6960b04
31 files changed
+1611 -2123

No files matched your search

+47 -11
View File
@@ -489,7 +489,17 @@ workspaceSettingsForm.addEventListener("submit", async event => {
submit.disabled = false;
}
});
document.querySelector("#new-note-button").addEventListener("click", () => document.querySelector("#note-dialog").showModal());
function updateNoteProtectionExplanation() {
const message = document.querySelector("#note-archive-explanation");
if (!message) return;
message.textContent = info?.archive_deleted_notes
? t("workspace.noteProtection.archiveEnabled", {}, "Archiving is enabled: authorized deletion moves the note, its history and files to Archived notes. The workspace owner can restore it.")
: t("workspace.noteProtection.archiveDisabled", {}, "Archiving is disabled: authorized deletion permanently removes the note and its files. Enable archiving in Workspace settings if recovery is important.");
}
document.querySelector("#new-note-button").addEventListener("click", () => {
updateNoteProtectionExplanation();
document.querySelector("#note-dialog").showModal();
});
document.querySelector("#cancel-note").addEventListener("click", () => document.querySelector("#note-dialog").close());
document.querySelector("#note-form").addEventListener("submit", async e => {
e.preventDefault();
@@ -542,21 +552,47 @@ document.querySelector("#copy-workspace-link").addEventListener("click", async (
catch (e) { toast.danger(e.message, { title: "Could not copy workspace link" }); }
});
async function startAuthorizedWorkspace() {
const session = await validateCurrentSession();
accountSession = session;
nickname = session?.nickname || getNickname();
const loading = window.__RUSTPAD_LOADING__;
document.querySelector("#workspace-startup-error")?.setAttribute("hidden", "");
try {
const session = await validateCurrentSession();
accountSession = session;
nickname = session?.nickname || getNickname();
if (!nickname) {
if (!nickname) {
loading?.complete("access");
workspaceContent.hidden = true;
if (!identityDialog.open) identityDialog.showModal();
loading?.skip("files");
loading?.ready();
return;
}
accessToken = shareToken || getAccessToken("workspace", slug);
workspaceContent.hidden = false;
await init();
loading?.complete("access");
if (workspaceLockedForPassword) loading?.skip("files");
else loading?.complete("files");
loading?.ready();
} catch (error) {
loading?.fail(error);
console.error("Workspace initialization failed", error);
workspaceContent.hidden = true;
if (!identityDialog.open) identityDialog.showModal();
return;
const panel = document.querySelector("#workspace-startup-error");
const message = document.querySelector("#workspace-startup-message");
if (message) message.textContent = `${t("workspace.connectionError", {}, "Workspace connection error")}: ${error?.message || "Please retry."}`;
if (panel) panel.hidden = false;
}
accessToken = shareToken || getAccessToken("workspace", slug);
workspaceContent.hidden = false;
await init();
}
document.querySelector("#workspace-startup-retry")?.addEventListener("click", async event => {
const button = event.currentTarget;
button.disabled = true;
try { await startAuthorizedWorkspace(); }
finally { button.disabled = false; }
});
bindIdentityDialog({
dialog: identityDialog,
onIdentity: async (value, session) => {