fix: only send to next signer on create
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 32s
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 32s
This commit is contained in:
parent
e85e9519d2
commit
3b4bf9aa29
@ -716,25 +716,21 @@ export const CreatePage = () => {
|
||||
toast.error('Failed to publish notifications')
|
||||
})
|
||||
|
||||
// Send DM to the next signer
|
||||
setLoadingSpinnerDesc('Sending DMs')
|
||||
// Send DM to signers and viewers
|
||||
if (signers.length > 0 && signers[0].pubkey !== usersPubkey) {
|
||||
// No need to send notification to self so remove it from the list
|
||||
const receivers = (
|
||||
signers.length > 0
|
||||
? [signers[0].pubkey]
|
||||
: viewers.map((viewer) => viewer.pubkey)
|
||||
).filter((receiver) => receiver !== usersPubkey)
|
||||
const nextSigner = signers[0].pubkey
|
||||
|
||||
for (let i = 0; i < receivers.length; i++) {
|
||||
if (nextSigner) {
|
||||
const createSignatureEvent = await parseNostrEvent(
|
||||
meta.createSignature
|
||||
)
|
||||
const { id } = createSignatureEvent
|
||||
const r = receivers[i]
|
||||
try {
|
||||
await sendPrivateDirectMessage(
|
||||
`Sigit created, visit ${window.location.origin}/#/${signers.length > 0 ? 'sign' : 'verify'}/${id}`,
|
||||
npubToHex(r!)!
|
||||
`Sigit created, visit ${window.location.origin}/#/sign/${id}`,
|
||||
npubToHex(nextSigner)!
|
||||
)
|
||||
} catch (error) {
|
||||
if (error instanceof SendDMError) {
|
||||
@ -743,6 +739,7 @@ export const CreatePage = () => {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
navigate(appPrivateRoutes.sign, { state: { meta } })
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user