Fix a few bugs

This commit is contained in:
Jonathan Staab 2023-02-20 08:46:40 -06:00
parent 955a6518e9
commit 8fd75bf26a
4 changed files with 22 additions and 15 deletions

View File

@ -2,12 +2,17 @@
- [ ] Try lumping tables into a single key each to reduce load/save contention and time
- [ ] Keep track of relays that fail to connect and don't use them
- [ ] Do round robin of user read relays batched by 10 on global feed
- Try paginating again, keep track of last time the feed was visited to ensure fresh content
- [ ] Put feed state and scroll positionn outside component so you can go back to it.
- [ ] Trim feeds once the user scrolls way down to save on memory
- [ ] Make main page for notes a list of editable custom view cards
# Snacks
- [ ] Following indicator on person info
- [ ] Change feed tabs to follows/network
- [ ] Don't lose feeds when navigating, persist modals
- [ ] Don't lose feeds when navigating, persist modals. Remember scroll state
- [ ] Share button for notes, shows qr code and nevent
- [ ] If a user has no write relays (or is not logged in), open a modal
- [ ] open web+nostr links like snort

View File

@ -4,7 +4,7 @@ import {get} from 'svelte/store'
import {first} from "hurdak/lib/hurdak"
import {log} from 'src/util/logger'
import {roomAttrs, displayPerson} from 'src/util/nostr'
import {getPubkeyWriteRelays, getRelayForPersonHint} from 'src/agent/relays'
import {getPubkeyWriteRelays, getRelayForPersonHint, getUserReadRelays} from 'src/agent/relays'
import database from 'src/agent/database'
import network from 'src/agent/network'
import keys from 'src/agent/keys'
@ -46,7 +46,7 @@ const createDirectMessage = (relays, pubkey, content) =>
const createNote = (relays, content, mentions = [], topics = []) => {
mentions = mentions.map(pubkey => {
const name = displayPerson(database.getPersonWithFallback(pubkey))
const [{url}] = getPubkeyWriteRelays(pubkey)
const [{url}] = getPubkeyWriteRelays(pubkey) || getUserReadRelays()
return ["p", pubkey, url, name]
})
@ -72,12 +72,12 @@ const createReaction = (relays, note, content) => {
const createReply = (relays, note, content, mentions = [], topics = []) => {
topics = topics.map(t => ["t", t])
mentions = mentions.map(pubkey => {
const [{url}] = getRelayForPersonHint(pubkey, note)
const {url} = getRelayForPersonHint(pubkey, note)
return ["p", pubkey, url]
})
const [{url}] = getRelayForPersonHint(note.pubkey, note)
const {url} = getRelayForPersonHint(note.pubkey, note)
const tags = uniqBy(
join(':'),
note.tags

View File

@ -173,15 +173,17 @@
.filter(e => e.matches('.note'))
)
const height = (
getHeight(noteContainer)
+ getHeight(replyContainer)
+ getHeight(childrenContainer)
- getHeight(lastChild)
- getHeight(lastChild.nextElementSibling)
)
if (lastChild) {
const height = (
getHeight(noteContainer)
+ getHeight(replyContainer)
+ getHeight(childrenContainer)
- getHeight(lastChild)
- getHeight(lastChild.nextElementSibling)
)
border.style = `height: ${height - 21}px`
border.style = `height: ${height - 21}px`
}
}
}

View File

@ -18,7 +18,7 @@
let crypt = keys.getCrypt()
let {data: pubkey} = nip19.decode(entity) as {data: string}
let person = database.watch('people', p => p.get(pubkey))
let person = database.watch('people', () => database.getPersonWithFallback(pubkey))
messages.lastCheckedByPubkey.update($obj => ({...$obj, [pubkey]: now()}))
@ -55,7 +55,7 @@
const events = fromThem.concat(toThem).filter(e => e.created_at < until)
const messages = sortBy(e => -e.created_at, events).slice(0, limit)
return await decryptMessages(messages)
return await decryptMessages(messages)
}
const sendMessage = async content => {