fix: Opening a sigit asks you to sign when you are not the next signer #285

Merged
b merged 4 commits from issue-281 into staging 2024-12-24 10:02:36 +00:00
2 changed files with 12 additions and 5 deletions

View File

@ -47,12 +47,12 @@ export const DisplaySigit = ({
const { extensions, isSame } = extractFileExtensions(Object.keys(fileHashes))
const currentUserNpub: string = usersPubkey ? hexToNpub(usersPubkey) : ''
const currentUserSigned =
signersStatus[currentUserNpub as `npub1${string}`] === SignStatus.Signed
const currentUserNextSigner =
signersStatus[currentUserNpub as `npub1${string}`] === SignStatus.Awaiting
return (
<div className={styles.itemWrapper}>
{signedStatus === SigitStatus.Complete || currentUserSigned ? (
{signedStatus === SigitStatus.Complete || !currentUserNextSigner ? (
<Link
to={`${appPublicRoutes.verify}/${sigitCreateId}`}
className={styles.insetLink}

View File

@ -25,7 +25,7 @@ import {
NostrController,
RelayController
} from '../../controllers'
import { appPrivateRoutes } from '../../routes'
import { appPrivateRoutes, appPublicRoutes } from '../../routes'
import {
CreateSignatureEventContent,
KeyboardCode,
@ -950,7 +950,14 @@ export const CreatePage = () => {
toast.error('Failed to publish notifications')
})
navigate(appPrivateRoutes.sign, { state: { meta } })
const isFirstSigner = signers[0].pubkey === usersPubkey
if (isFirstSigner) {
navigate(appPrivateRoutes.sign, { state: { meta } })
} else {
const createSignatureJson = JSON.parse(createSignature)
navigate(`${appPublicRoutes.verify}/${createSignatureJson.id}`)
}
} else {
const zip = new JSZip()