Skip to content

Commit

Permalink
Throw an error instead on unknown reason for read-only status
Browse files Browse the repository at this point in the history
  • Loading branch information
adzialocha committed Nov 16, 2023
1 parent 239b0cd commit 1f5ddc2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/renderer/components/composer/DisabledMessageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const DisabledMessageInput = ({ reason }: Props) => {
return tx('messaging_disabled_not_in_group')
case DisabledChatReasons.DEADDROP:
return tx('messaging_disabled_deaddrop')
case DisabledChatReasons.UNKNOWN:
return 'UNKNOWN_DISABLED_CHAT_REASON'
}
}, [reason, tx])

Expand Down
5 changes: 3 additions & 2 deletions src/renderer/components/composer/useIsChatDisabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export enum DisabledChatReasons {
DEVICE_CHAT,
MAILING_LIST,
NOT_IN_GROUP,
UNKNOWN,
}

export default function useIsChatDisabled(
Expand All @@ -28,5 +27,7 @@ export default function useIsChatDisabled(
return [true, DisabledChatReasons.NOT_IN_GROUP]
}

return [true, DisabledChatReasons.UNKNOWN]
throw new Error(
'Could not determine read-only state of chat due to invalid chat information'
)
}

0 comments on commit 1f5ddc2

Please sign in to comment.