*If we are setting the entry, only respond if successful

*If we are skipping the set, respond
This commit is contained in:
Derrick Hammer 2022-12-31 20:28:04 -05:00
parent c734832952
commit 9a3a933dc5
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 14 additions and 11 deletions

View File

@ -109,9 +109,11 @@ const plugin: Plugin = {
let entry = (await getEntry(newEntry.pk)) as SignedRegistryEntry;
async function setAndRespond(entry: SignedRegistryEntry, set = true) {
let ret = true;
if (set) {
await setEntry(newEntry);
ret = await setEntry(newEntry);
}
if (ret) {
sendDirectOrBroadcast(
Message.create({
type: MessageType.CREATED,
@ -123,6 +125,7 @@ const plugin: Plugin = {
origin
);
}
}
if (entry) {
if (newEntry.revision <= entry.revision) {