fix(app): channel sync keeps a new channel's empty fields out on retry, orders saves, drops stale lookups
- A rate-limited edit of a newly registered channel is retried with the same "never clear Discord with an empty field" rule (it was retried as an existing channel and cleared the topic). - Channel edits go one at a time, and Discord's form of the name is written back only while the settings still hold the name that was sent, so a slow answer to an earlier save never overwrites a later one. - The chat channel screen drops a Discord name/topic lookup that answers after the ID was changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,9 +140,11 @@ function chatChannelsEditor(f, value) {
|
||||
const desc = h("input", { type: "text", value: c.description ?? "", placeholder: "무엇에 쓰는 채널인지", "data-k": "description" });
|
||||
// A newly registered channel starts with its Discord name and topic.
|
||||
id.addEventListener("change", async () => {
|
||||
if (!id.value.trim() || (name.value && desc.value)) return;
|
||||
const asked = id.value.trim();
|
||||
if (!asked || (name.value && desc.value)) return;
|
||||
try {
|
||||
const info = await api("discord_channel_info", { id: id.value.trim() });
|
||||
const info = await api("discord_channel_info", { id: asked });
|
||||
if (id.value.trim() !== asked) return; // the ID changed meanwhile: this answer is for another channel
|
||||
if (!name.value) name.value = info.name;
|
||||
if (!desc.value) desc.value = info.topic;
|
||||
} catch (e) { fail(e); }
|
||||
|
||||
Reference in New Issue
Block a user