fix: 🐛
This commit is contained in:
@@ -47,6 +47,9 @@ export default function MailboxSetting() {
|
||||
const saveNewMailboxRelay = (url: string) => {
|
||||
if (url === '') return null
|
||||
const normalizedUrl = normalizeUrl(url)
|
||||
if (!normalizedUrl) {
|
||||
return t('Invalid relay URL')
|
||||
}
|
||||
if (relays.some((r) => r.url === normalizedUrl)) {
|
||||
return t('Relay already exists')
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ export default function RelayUrls({ relaySetId }: { relaySetId: string }) {
|
||||
const saveNewRelayUrl = () => {
|
||||
if (newRelayUrl === '') return
|
||||
const normalizedUrl = normalizeUrl(newRelayUrl)
|
||||
if (!normalizedUrl) {
|
||||
return setNewRelayUrlError(t('Invalid relay URL'))
|
||||
}
|
||||
if (relaySet.relayUrls.includes(normalizedUrl)) {
|
||||
return setNewRelayUrlError(t('Relay already exists'))
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function SaveRelayDropdownMenu({
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const { relaySets } = useRelaySets()
|
||||
const normalizedUrls = useMemo(() => urls.map((url) => normalizeUrl(url)), [urls])
|
||||
const normalizedUrls = useMemo(() => urls.map((url) => normalizeUrl(url)).filter(Boolean), [urls])
|
||||
const alreadySaved = useMemo(
|
||||
() => relaySets.some((set) => normalizedUrls.every((url) => set.relayUrls.includes(url))),
|
||||
[relaySets, normalizedUrls]
|
||||
|
||||
Reference in New Issue
Block a user