fix: remove both from UserRole enum
All checks were successful
Release / build_and_release (push) Successful in 1m7s

This commit is contained in:
SwiftHawk 2024-05-14 15:37:55 +05:00
parent 56b137774d
commit b5273393e6
3 changed files with 6 additions and 24 deletions

View File

@ -218,12 +218,8 @@ export const SignPage = () => {
zip.file(`files/${file.name}`, file)
})
const signers = users.filter(
(user) => user.role === UserRole.signer || user.role === UserRole.both
)
const viewers = users.filter(
(user) => user.role === UserRole.viewer || user.role === UserRole.both
)
const signers = users.filter((user) => user.role === UserRole.signer)
const viewers = users.filter((user) => user.role === UserRole.viewer)
setLoadingSpinnerDesc('Signing nostr event')
const signedEvent = await signEventForMetaFile(
@ -398,7 +394,6 @@ export const SignPage = () => {
>
<MenuItem value={UserRole.signer}>{UserRole.signer}</MenuItem>
<MenuItem value={UserRole.viewer}>{UserRole.viewer}</MenuItem>
<MenuItem value={UserRole.both}>{UserRole.both}</MenuItem>
</Select>
</FormControl>
@ -527,7 +522,6 @@ const DisplayUser = ({
<MenuItem value={UserRole.viewer}>
{UserRole.viewer}
</MenuItem>
<MenuItem value={UserRole.both}>{UserRole.both}</MenuItem>
</Select>
</TableCell>
<TableCell>

View File

@ -581,10 +581,6 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
useEffect(() => {
meta.signers.forEach((signer) => {
const userRole = meta.viewers.includes(signer)
? UserRole.both
: UserRole.signer
setUsers((prev) => {
if (prev.findIndex((user) => user.pubkey === signer) !== -1) return prev
@ -592,17 +588,13 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
...prev,
{
pubkey: signer,
role: userRole
role: UserRole.signer
}
]
})
})
meta.viewers.forEach((viewer) => {
const userRole = meta.signers.includes(viewer)
? UserRole.both
: UserRole.viewer
setUsers((prev) => {
if (prev.findIndex((user) => user.pubkey === viewer) !== -1) return prev
@ -610,7 +602,7 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
...prev,
{
pubkey: viewer,
role: userRole
role: UserRole.viewer
}
]
})
@ -760,10 +752,7 @@ const DisplayMeta = ({ meta, nextSigner }: DisplayMetaProps) => {
if (user.role === UserRole.viewer) {
signedStatus = '-'
} else if (
user.role === UserRole.signer ||
user.role === UserRole.both
) {
} else {
// check if user has signed the document
if (user.pubkey in meta.signedEvents) {
signedStatus = 'Signed'

View File

@ -1,7 +1,6 @@
export enum UserRole {
signer = 'Signer',
viewer = 'Viewer',
both = 'Both'
viewer = 'Viewer'
}
export interface User {