forked from coracle/flotilla
Fix some space joining errors
This commit is contained in:
@@ -123,7 +123,7 @@
|
||||
<div class="card2 bg-alt flex flex-col gap-4">
|
||||
<p class="opacity-75">You're about to join:</p>
|
||||
<RelaySummary url={inviteData.url} />
|
||||
<SpaceJoinSettings url={inviteData.url} bind:error bind:notifications />
|
||||
<SpaceJoinSettings url={inviteData.url} {error} bind:notifications />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<Modal tag="form" onsubmit={preventDefault(join)}>
|
||||
<ModalBody>
|
||||
<RelaySummary {url} />
|
||||
<SpaceJoinSettings {url} bind:error bind:notifications />
|
||||
<SpaceJoinSettings {url} {error} bind:notifications />
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button class="btn btn-link" onclick={back} disabled={loading}>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
notifications: boolean
|
||||
}
|
||||
|
||||
let {url, error = $bindable(), notifications = $bindable()}: Props = $props()
|
||||
let {url, error, notifications = $bindable()}: Props = $props()
|
||||
</script>
|
||||
|
||||
<div class="card2 card2-sm bg-alt">
|
||||
|
||||
@@ -22,27 +22,27 @@
|
||||
const title = getTagValue("title", event.tags)
|
||||
</script>
|
||||
|
||||
<Link
|
||||
href={makeThreadPath(url, event.id)}
|
||||
class="grid grid-cols-[1fr_auto] gap-x-3 gap-y-1 border-b border-base-content/10 px-3 py-3 transition-colors hover:bg-base-200/50 sm:grid-cols-[1fr_8rem_5rem_8rem] sm:items-center sm:gap-x-4 sm:px-4">
|
||||
<div class="col-span-2 min-w-0 sm:col-span-1">
|
||||
<p class="ellipsize text-sm font-bold sm:text-base">{title || "Untitled thread"}</p>
|
||||
<p class="ellipsize mt-0.5 text-xs opacity-60 sm:hidden">
|
||||
by <ProfileName pubkey={event.pubkey} {url} />
|
||||
</p>
|
||||
</div>
|
||||
<div class="hidden items-center gap-2 sm:flex">
|
||||
<tr>
|
||||
<td>
|
||||
<Link href={makeThreadPath(url, event.id)}>
|
||||
<p class="ellipsize text-sm font-bold sm:text-base">{title || "Untitled thread"}</p>
|
||||
<p class="ellipsize mt-0.5 text-xs opacity-60 sm:hidden">
|
||||
by <ProfileName pubkey={event.pubkey} {url} />
|
||||
</p>
|
||||
</Link>
|
||||
</td>
|
||||
<td>
|
||||
<ProfileCircle pubkey={event.pubkey} {url} size={6} />
|
||||
<span class="ellipsize text-sm">
|
||||
<ProfileName pubkey={event.pubkey} {url} />
|
||||
</span>
|
||||
</div>
|
||||
<p class="text-right text-xs opacity-75 sm:text-center sm:text-sm">
|
||||
</td>
|
||||
<td>
|
||||
<span class="opacity-60 sm:hidden">Replies · </span>
|
||||
{replyCount}
|
||||
</p>
|
||||
<p class="text-right text-xs opacity-75 sm:text-sm">
|
||||
</td>
|
||||
<td>
|
||||
<span class="opacity-60 sm:hidden">Last · </span>
|
||||
{formatTimestamp(lastActive)}
|
||||
</p>
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ export const mostlyRestrictedPolicy = (socket: Socket) => {
|
||||
const pending = new Set<string>()
|
||||
|
||||
const updateStatus = (error?: string) => {
|
||||
if (restricted > total / 2) {
|
||||
if (total > 5 && restricted > total / 2) {
|
||||
if (error) {
|
||||
return relaysMostlyRestricted.update(assoc(socket.url, error))
|
||||
}
|
||||
|
||||
+15
-5
@@ -177,14 +177,24 @@ export const attemptRelayAccess = async (url: string, claim = "") => {
|
||||
return `Failed to connect`
|
||||
}
|
||||
|
||||
// Some relays are extra slow, remove this when welshman is updated
|
||||
await poll({
|
||||
signal: AbortSignal.timeout(3000),
|
||||
condition: () => socket.auth.status === AuthStatus.Requested,
|
||||
})
|
||||
|
||||
await socket.auth.attemptAuth(sign)
|
||||
|
||||
// Some relays are extra slow, remove this when welshman is updated
|
||||
await poll({
|
||||
signal: AbortSignal.timeout(3000),
|
||||
condition: () => socket.auth.status !== AuthStatus.PendingResponse,
|
||||
})
|
||||
|
||||
if (![AuthStatus.None, AuthStatus.Ok].includes(socket.auth.status)) {
|
||||
if (socket.auth.details) {
|
||||
return `Failed to authenticate (${socket.auth.details})`
|
||||
} else {
|
||||
return `Failed to authenticate (${last(socket.auth.status.split(":"))})`
|
||||
}
|
||||
const message = socket.auth.details || last(socket.auth.status.split(":"))
|
||||
|
||||
return `Failed to authenticate (${message})`
|
||||
}
|
||||
|
||||
const error = await waitForThunkError(publishJoinRequest({url, claim}))
|
||||
|
||||
+12
-8
@@ -79,18 +79,22 @@ export const makeSpacePath = (url: string, ...extra: (string | undefined)[]) =>
|
||||
return path
|
||||
}
|
||||
|
||||
export const goToSpace = async (url: string) => {
|
||||
export const goToSpace = (url: string) => {
|
||||
const prevPath = lastPageBySpaceUrl.get(encodeRelay(url))
|
||||
|
||||
if (prevPath && prevPath !== makeSpacePath(url)) {
|
||||
goto(prevPath, {replaceState: true})
|
||||
} else if (!hasNip29(getRelay(url))) {
|
||||
goto(makeSpaceChatPath(url), {replaceState: true})
|
||||
} else if (window.matchMedia(`(min-width: ${theme.screens.md})`).matches) {
|
||||
goto(makeSpacePath(url, "about"), {replaceState: true})
|
||||
} else {
|
||||
goto(makeSpacePath(url), {replaceState: true})
|
||||
return goto(prevPath, {replaceState: true})
|
||||
}
|
||||
|
||||
if (!hasNip29(getRelay(url))) {
|
||||
return goto(makeSpaceChatPath(url), {replaceState: true})
|
||||
}
|
||||
|
||||
if (window.matchMedia(`(min-width: ${theme.screens.md})`).matches) {
|
||||
return goto(makeSpacePath(url, "about"), {replaceState: true})
|
||||
}
|
||||
|
||||
return goto(makeSpacePath(url), {replaceState: true})
|
||||
}
|
||||
|
||||
// Content types, events
|
||||
|
||||
Reference in New Issue
Block a user