fix: remove both from UserRole enum
All checks were successful
Release / build_and_release (push) Successful in 1m7s
All checks were successful
Release / build_and_release (push) Successful in 1m7s
This commit is contained in:
parent
56b137774d
commit
b5273393e6
@ -218,12 +218,8 @@ export const SignPage = () => {
|
|||||||
zip.file(`files/${file.name}`, file)
|
zip.file(`files/${file.name}`, file)
|
||||||
})
|
})
|
||||||
|
|
||||||
const signers = users.filter(
|
const signers = users.filter((user) => user.role === UserRole.signer)
|
||||||
(user) => user.role === UserRole.signer || user.role === UserRole.both
|
const viewers = users.filter((user) => user.role === UserRole.viewer)
|
||||||
)
|
|
||||||
const viewers = users.filter(
|
|
||||||
(user) => user.role === UserRole.viewer || user.role === UserRole.both
|
|
||||||
)
|
|
||||||
|
|
||||||
setLoadingSpinnerDesc('Signing nostr event')
|
setLoadingSpinnerDesc('Signing nostr event')
|
||||||
const signedEvent = await signEventForMetaFile(
|
const signedEvent = await signEventForMetaFile(
|
||||||
@ -398,7 +394,6 @@ export const SignPage = () => {
|
|||||||
>
|
>
|
||||||
<MenuItem value={UserRole.signer}>{UserRole.signer}</MenuItem>
|
<MenuItem value={UserRole.signer}>{UserRole.signer}</MenuItem>
|
||||||
<MenuItem value={UserRole.viewer}>{UserRole.viewer}</MenuItem>
|
<MenuItem value={UserRole.viewer}>{UserRole.viewer}</MenuItem>
|
||||||
<MenuItem value={UserRole.both}>{UserRole.both}</MenuItem>
|
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
@ -527,7 +522,6 @@ const DisplayUser = ({
|
|||||||
<MenuItem value={UserRole.viewer}>
|
<MenuItem value={UserRole.viewer}>
|
||||||
{UserRole.viewer}
|
{UserRole.viewer}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem value={UserRole.both}>{UserRole.both}</MenuItem>
|
|
||||||
</Select>
|
</Select>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
|
@ -581,10 +581,6 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
meta.signers.forEach((signer) => {
|
meta.signers.forEach((signer) => {
|
||||||
const userRole = meta.viewers.includes(signer)
|
|
||||||
? UserRole.both
|
|
||||||
: UserRole.signer
|
|
||||||
|
|
||||||
setUsers((prev) => {
|
setUsers((prev) => {
|
||||||
if (prev.findIndex((user) => user.pubkey === signer) !== -1) return prev
|
if (prev.findIndex((user) => user.pubkey === signer) !== -1) return prev
|
||||||
|
|
||||||
@ -592,17 +588,13 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
|
|||||||
...prev,
|
...prev,
|
||||||
{
|
{
|
||||||
pubkey: signer,
|
pubkey: signer,
|
||||||
role: userRole
|
role: UserRole.signer
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
meta.viewers.forEach((viewer) => {
|
meta.viewers.forEach((viewer) => {
|
||||||
const userRole = meta.signers.includes(viewer)
|
|
||||||
? UserRole.both
|
|
||||||
: UserRole.viewer
|
|
||||||
|
|
||||||
setUsers((prev) => {
|
setUsers((prev) => {
|
||||||
if (prev.findIndex((user) => user.pubkey === viewer) !== -1) return prev
|
if (prev.findIndex((user) => user.pubkey === viewer) !== -1) return prev
|
||||||
|
|
||||||
@ -610,7 +602,7 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
|
|||||||
...prev,
|
...prev,
|
||||||
{
|
{
|
||||||
pubkey: viewer,
|
pubkey: viewer,
|
||||||
role: userRole
|
role: UserRole.viewer
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@ -760,10 +752,7 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
|
|||||||
|
|
||||||
if (user.role === UserRole.viewer) {
|
if (user.role === UserRole.viewer) {
|
||||||
signedStatus = '-'
|
signedStatus = '-'
|
||||||
} else if (
|
} else {
|
||||||
user.role === UserRole.signer ||
|
|
||||||
user.role === UserRole.both
|
|
||||||
) {
|
|
||||||
// check if user has signed the document
|
// check if user has signed the document
|
||||||
if (user.pubkey in meta.signedEvents) {
|
if (user.pubkey in meta.signedEvents) {
|
||||||
signedStatus = 'Signed'
|
signedStatus = 'Signed'
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
export enum UserRole {
|
export enum UserRole {
|
||||||
signer = 'Signer',
|
signer = 'Signer',
|
||||||
viewer = 'Viewer',
|
viewer = 'Viewer'
|
||||||
both = 'Both'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface User {
|
export interface User {
|
||||||
|
Loading…
Reference in New Issue
Block a user