This build was committed by a bot.

This commit is contained in:
github-actions[bot]
2026-08-30 18:19:46 +00:00
parent cc8b523816
commit a4a2c2c0d2
3 changed files with 14 additions and 4 deletions

View File

@@ -2102,7 +2102,17 @@ $(el.threadSyncBtn).on("click", async () => {
}
if (t.type !== "thread") continue;
if (t.status === "modified" || t.status === "new") {
const newName = serializeThreadName(t), msgs = await localforage.getItem("rem_t_" + t.id);
const newName = serializeThreadName(t);
let msgs = await localforage.getItem("rem_t_" + t.id);
if ((!msgs || !Array.isArray(msgs)) && remoteMap[t.id]) {
const text = await ghGetFileContent(info, remoteMap[t.id].name);
if (text) try {
msgs = JSON.parse(text);
await localforage.setItem("rem_t_" + t.id, msgs);
} catch (e) {
console.error(e);
}
}
if (remoteMap[t.id] && remoteMap[t.id].name !== newName) await ghApi(`${info.apiPath}/${remoteMap[t.id].name}`, "DELETE", {
message: `Rename thread ${t.id}`,
sha: remoteMap[t.id].sha,
@@ -2111,7 +2121,7 @@ $(el.threadSyncBtn).on("click", async () => {
const x = await ghApi(`${info.apiPath}/${newName}?ref=${info.branch}`);
await ghApi(`${info.apiPath}/${newName}`, "PUT", {
message: `Sync thread ${t.id}`,
content: utob(JSON.stringify(msgs, null, 2)),
content: utob(JSON.stringify(msgs || [], null, 2)),
branch: info.branch,
sha: x?.sha
});