refactor: show sent dm count, don't sent twice to creator
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 33s

This commit is contained in:
enes 2024-10-14 13:19:44 +02:00
parent 3b4bf9aa29
commit b04f4fb88d

View File

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