mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 00:10:52 +00:00
Improve quote loading
This commit is contained in:
parent
167e5786f7
commit
2fa274ffee
@ -20,6 +20,7 @@
|
||||
- [x] Use a bloom filter for deletes
|
||||
- [x] Remember reply drafts
|
||||
- [x] Topic/keyword mutes
|
||||
- [x] Improve quote loading
|
||||
|
||||
# 0.3.6
|
||||
|
||||
|
@ -11,8 +11,9 @@
|
||||
loadPubkeys,
|
||||
displayPubkey,
|
||||
isEventMuted,
|
||||
getEventHints,
|
||||
getParentHints,
|
||||
isShareableRelay,
|
||||
getUserRelayUrls,
|
||||
mergeHints,
|
||||
} from "src/engine"
|
||||
|
||||
@ -26,13 +27,15 @@
|
||||
const openPerson = pubkey => modal.push({type: "person/detail", pubkey})
|
||||
|
||||
const {id, identifier, kind, pubkey} = value
|
||||
|
||||
load({
|
||||
relays: mergeHints([
|
||||
const relays = mergeHints([
|
||||
// Agora social has a bug
|
||||
(value.relays || []).flatMap(r => r.split(",")).filter(isShareableRelay),
|
||||
getEventHints(note),
|
||||
]),
|
||||
getUserRelayUrls("read"),
|
||||
getParentHints(note),
|
||||
])
|
||||
|
||||
load({
|
||||
relays,
|
||||
filters: [
|
||||
id
|
||||
? {ids: [id]}
|
||||
@ -56,7 +59,7 @@
|
||||
|
||||
// stopPropagation wasn't working for some reason
|
||||
if (noteId && e.target.textContent !== "Show") {
|
||||
modal.push({type: "note/detail", note: {id: noteId}})
|
||||
modal.push({type: "note/detail", note: quote || {id: noteId}, relays})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ export const execute = () => {
|
||||
return
|
||||
}
|
||||
|
||||
info(`Loading ${queue.length} grouped requests`, filters)
|
||||
const nRequests = queue.length
|
||||
|
||||
const itemsByRelay = {}
|
||||
for (const item of queue.splice(0)) {
|
||||
@ -38,6 +38,8 @@ export const execute = () => {
|
||||
}
|
||||
}
|
||||
|
||||
info(`Loading ${nRequests} grouped requests`, filters)
|
||||
|
||||
const tracker = new Tracker()
|
||||
|
||||
// Group by relay, then by filter
|
||||
@ -80,6 +82,10 @@ export const execute = () => {
|
||||
}
|
||||
|
||||
export const load = (request: LoadOpts) => {
|
||||
if (request.filters.length === 0) {
|
||||
return Promise.resolve([])
|
||||
}
|
||||
|
||||
const result = defer()
|
||||
|
||||
if (queue.length === 0) {
|
||||
|
@ -44,7 +44,7 @@ export const displayRelay = ({url}: Relay) => last(url.split("://"))
|
||||
export const getRelaySearch = $relays => fuzzy($relays, {keys: ["url", "name", "description"]})
|
||||
|
||||
export const getSearchableRelays = $relays => {
|
||||
const urls = $relays.filter(r => (r.info?.supported_nips || []).includes(50)).map(prop("url"))
|
||||
const urls = pluck('url', $relays.filter(r => (r.info?.supported_nips || []).includes(50)))
|
||||
|
||||
return uniq(env.get().SEARCH_RELAYS.concat(urls)).slice(0, 8) as string[]
|
||||
}
|
||||
|
@ -130,7 +130,8 @@ export const findRoot = (e: Event) => prop("root", findReplyAndRoot(e))
|
||||
|
||||
export const findRootId = (e: Event) => findRoot(e)?.[1]
|
||||
|
||||
export const isLike = (content: string) => ["", "+", "🤙", "👍", "❤️", "😎", "🏅"].includes(content)
|
||||
export const isLike = (content: string) =>
|
||||
["", "+", "🤙", "👍", "❤️", "😎", "🏅", "🫂"].includes(content)
|
||||
|
||||
export const channelAttrs = ["name", "about", "picture"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user