fix(dm): don't send private DM twice to same signer

This commit is contained in:
en 2025-02-07 14:49:25 +01:00
parent e405b735f7
commit 1474fafde7

View File

@ -633,7 +633,8 @@ export const SignPage = () => {
) )
} }
} else { } else {
// Notify the creator and the next signer (/sign). // Notify the creator and
// the next signer (/sign).
try { try {
await sendPrivateDirectMessage( await sendPrivateDirectMessage(
`Sigit signed by ${usersNpub}, visit ${window.location.origin}/#/sign/${id}`, `Sigit signed by ${usersNpub}, visit ${window.location.origin}/#/sign/${id}`,
@ -648,12 +649,12 @@ export const SignPage = () => {
// No need to notify creator twice, skipping // No need to notify creator twice, skipping
const currentSignerIndex = signers.indexOf(usersNpub) const currentSignerIndex = signers.indexOf(usersNpub)
const nextSigner = signers[currentSignerIndex + 1] const nextSigner = npubToHex(signers[currentSignerIndex + 1])
if (nextSigner !== submittedBy) { if (nextSigner !== submittedBy) {
try { try {
await sendPrivateDirectMessage( await sendPrivateDirectMessage(
`You're the next signer, visit ${window.location.origin}/#/sign/${id}`, `You're the next signer, visit ${window.location.origin}/#/sign/${id}`,
npubToHex(nextSigner)! nextSigner!
) )
} catch (error) { } catch (error) {
if (error instanceof SendDMError) { if (error instanceof SendDMError) {