wip: Send dm on sigit sign/complete #230

Draft
enes wants to merge 3 commits from 92-send-completion-dm into staging
Showing only changes of commit b04f4fb88d - Show all commits

View File

@ -744,6 +744,12 @@ export const SignPage = () => {
console.error(error) console.error(error)
} }
} }
if (areSent.some((r) => r)) {
toast.success(
`DMs sent ${areSent.filter((r) => r).length}/${users.length}`
)
}
} else { } else {
// Notify the creator and the next signer (/sign). // Notify the creator and the next signer (/sign).
try { try {
@ -758,18 +764,21 @@ export const SignPage = () => {
console.error(error) console.error(error)
} }
try { // No need to notify creator twice, skipping
const currentSignerIndex = signers.indexOf(usersNpub) const currentSignerIndex = signers.indexOf(usersNpub)
const nextSigner = signers[currentSignerIndex + 1] const nextSigner = signers[currentSignerIndex + 1]
await sendPrivateDirectMessage( if (nextSigner !== submittedBy) {
`You're the next signer, visit ${window.location.origin}/#/sign/${id}`, try {
npubToHex(nextSigner)! await sendPrivateDirectMessage(
) `You're the next signer, visit ${window.location.origin}/#/sign/${id}`,
} catch (error) { npubToHex(nextSigner)!
if (error instanceof SendDMError) { )
toast.error(error.message) } catch (error) {
if (error instanceof SendDMError) {
toast.error(error.message)
}
console.error(error)
} }
console.error(error)
} }
} }