*If we are setting the entry, only respond if successful
*If we are skipping the set, respond
This commit is contained in:
parent
c734832952
commit
9a3a933dc5
25
src/index.ts
25
src/index.ts
|
@ -109,19 +109,22 @@ 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,
|
||||
pubkey: entry.pk,
|
||||
revision: entry.revision,
|
||||
signature: entry.signature,
|
||||
data: entry.data,
|
||||
}),
|
||||
origin
|
||||
);
|
||||
}
|
||||
sendDirectOrBroadcast(
|
||||
Message.create({
|
||||
type: MessageType.CREATED,
|
||||
pubkey: entry.pk,
|
||||
revision: entry.revision,
|
||||
signature: entry.signature,
|
||||
data: entry.data,
|
||||
}),
|
||||
origin
|
||||
);
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
|
|
Reference in New Issue