Fix quote length

This commit is contained in:
Jonathan Staab 2023-06-19 13:23:40 -07:00
parent d5b3d935a4
commit 24a198bf80
4 changed files with 63 additions and 22 deletions

View File

@ -1,5 +1,29 @@
# Current # Current
- [ ] White-labeled
- [ ] Add invite code registration for relay
- [ ] Add endpoint to nostream that updates whitelist
- [ ] Show invite code somewhere so users can share it.
- [ ] Use a signed string so it's based on pubkey?
- [ ] Nostream is public-read, apply registration to reads as well
- [ ] Avoid leaking events from private relays
- [ ] Image classification
- https://github.com/bhky/opennsfw2
- [ ] Convert app store to nip 89
- [ ] Put search icon in header or hover button, open in modal
- [ ] Centralize relays
- This is ok, relays are the source of decentralization
- clients can help with discoverability
- Add agent to dufflepud database that scrapes relays and reviews
- Serve relays from dufflepud
- Or maybe set up a special purpose relay for relay recs?
# Core
- [ ] Private groups
- [ ] Support server-rendered link previews
- [ ] Feeds load forever if a modal is open
- [ ] Support other list types than 30001
- [ ] Spam - [ ] Spam
- Add configurable POW req for replies - Add configurable POW req for replies
- Add event queue and undo, use the delay to calculate POW - Add event queue and undo, use the delay to calculate POW

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import {without} from "ramda" import {without, last} from "ramda"
import { import {
parseContent, parseContent,
getLinks, getLinks,
@ -18,7 +18,9 @@
import NoteContentQuote from "src/app/shared/NoteContentQuote.svelte" import NoteContentQuote from "src/app/shared/NoteContentQuote.svelte"
import NoteContentEntity from "src/app/shared/NoteContentEntity.svelte" import NoteContentEntity from "src/app/shared/NoteContentEntity.svelte"
export let note, anchorId, maxLength, showEntire export let note, maxLength
export let anchorId = false
export let showEntire = false
export let showMedia = false export let showMedia = false
const fullContent = parseContent(note) const fullContent = parseContent(note)
@ -44,13 +46,13 @@
<QRCode fullWidth onClick="copy" code={value} /> <QRCode fullWidth onClick="copy" code={value} />
</div> </div>
{:else if type === LINK} {:else if type === LINK}
<NoteContentLink {value} showMedia={showMedia && isStartOrEnd(i) && value.url.includes('/')} /> <NoteContentLink {value} showMedia={showMedia && isStartOrEnd(i) && last(value.url.split('://')).includes('/')} />
{:else if type.match(/^nostr:np(rofile|ub)$/)} {:else if type.match(/^nostr:np(rofile|ub)$/)}
<NoteContentPerson {value} /> <NoteContentPerson {value} />
{:else if type.startsWith("nostr:") && showMedia && isStartOrEnd(i) && value.id !== anchorId} {:else if type.startsWith("nostr:") && showMedia && isStartOrEnd(i) && value.id !== anchorId}
<NoteContentQuote {note} {value}> <NoteContentQuote {note} {value}>
<div slot="note-content" let:quote> <div slot="note-content" let:quote>
<svelte:self note={quote} /> <svelte:self note={quote} {anchorId} {maxLength} {showMedia} showEntire={false} />
</div> </div>
</NoteContentQuote> </NoteContentQuote>
{:else if type.startsWith("nostr:")} {:else if type.startsWith("nostr:")}

View File

@ -11,10 +11,13 @@
import {getPersonWithFallback} from "src/agent/db" import {getPersonWithFallback} from "src/agent/db"
import {sampleRelays} from "src/agent/relays" import {sampleRelays} from "src/agent/relays"
import network from "src/agent/network" import network from "src/agent/network"
import user from "src/agent/user"
export let note export let note
export let value export let value
let muted = false
const openPerson = pubkey => modal.push({type: "person/feed", pubkey}) const openPerson = pubkey => modal.push({type: "person/feed", pubkey})
const loadQuote = async () => { const loadQuote = async () => {
@ -28,14 +31,23 @@
filter: [{ids: [id]}], filter: [{ids: [id]}],
}) })
muted = user.applyMutes([event]).length === 0
return event || Promise.reject() return event || Promise.reject()
} catch (e) { } catch (e) {
warn(e) warn(e)
} }
} }
const openQuote = () => { const openQuote = e => {
modal.push({type: "note/detail", note: {id: value.id}}) // stopPropagation wasn't working for some reason
if (e.target.textContent !== "Show") {
modal.push({type: "note/detail", note: {id: value.id}})
}
}
const unmute = e => {
muted = false
} }
</script> </script>
@ -44,18 +56,25 @@
{#await loadQuote()} {#await loadQuote()}
<Spinner /> <Spinner />
{:then quote} {:then quote}
{@const person = getPersonWithFallback(quote.pubkey)} {#if muted}
<div class="mb-4 flex items-center gap-4"> <p class="mb-1 py-24 text-center text-gray-5" in:fly={{y: 20}}>
<PersonCircle size={6} {person} /> You have muted this note.
<Anchor <Anchor on:click={unmute}>Show</Anchor>
stopPropagation </p>
type="unstyled" {:else}
class="flex items-center gap-2" {@const person = getPersonWithFallback(quote.pubkey)}
on:click={() => openPerson(quote.pubkey)}> <div class="mb-4 flex items-center gap-4">
<h2 class="text-lg">{displayPerson(person)}</h2> <PersonCircle size={6} {person} />
</Anchor> <Anchor
</div> stopPropagation
<slot name="note-content" {quote} /> type="unstyled"
class="flex items-center gap-2"
on:click={() => openPerson(quote.pubkey)}>
<h2 class="text-lg">{displayPerson(person)}</h2>
</Anchor>
</div>
<slot name="note-content" {quote} />
{/if}
{:catch} {:catch}
<p class="mb-1 py-24 text-center text-gray-5" in:fly={{y: 20}}> <p class="mb-1 py-24 text-center text-gray-5" in:fly={{y: 20}}>
Unable to load a preview for quoted event Unable to load a preview for quoted event

View File

@ -144,10 +144,6 @@ export const createScroller = (loadMore, {reverse = false, element = null} = {})
element = element || document.body element = element || document.body
// NOTE TO FUTURE SELF
// If the scroller is saturating request channels on a slow relay, the
// loadMore function is not properly awaiting all the work necessary.
// That is the problem, but see commit 8371fde for another strategy
let done = false let done = false
const check = async () => { const check = async () => {
// While we have empty space, fill it // While we have empty space, fill it