*If responding with an existing entry, don't try to set

This commit is contained in:
Derrick Hammer 2022-12-31 16:40:12 -05:00
parent 1b876bb78f
commit c734832952
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 3 deletions

View File

@ -108,8 +108,10 @@ const plugin: Plugin = {
} }
let entry = (await getEntry(newEntry.pk)) as SignedRegistryEntry; let entry = (await getEntry(newEntry.pk)) as SignedRegistryEntry;
async function setAndRespond(entry: SignedRegistryEntry) { async function setAndRespond(entry: SignedRegistryEntry, set = true) {
await setEntry(newEntry); if (set) {
await setEntry(newEntry);
}
sendDirectOrBroadcast( sendDirectOrBroadcast(
Message.create({ Message.create({
type: MessageType.CREATED, type: MessageType.CREATED,
@ -127,7 +129,7 @@ const plugin: Plugin = {
setAndRespond(newEntry); setAndRespond(newEntry);
return; return;
} }
setAndRespond(entry); setAndRespond(entry, false);
return; return;
} }
setAndRespond(newEntry); setAndRespond(newEntry);