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