mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 11:43:35 +00:00
Fix list loading
This commit is contained in:
parent
80386a833c
commit
c937beccac
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
- [x] Add note preview when composing
|
- [x] Add note preview when composing
|
||||||
- [x] Merge advanced search, feed options, and lists
|
- [x] Merge advanced search, feed options, and lists
|
||||||
|
- [x] Fix loading lists on login
|
||||||
|
|
||||||
# 0.2.31
|
# 0.2.31
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {is, uniq, prop, reject, nth, uniqBy, objOf, pick, identity} from "ramda"
|
import {partition, is, uniq, reject, nth, objOf, pick, identity} from "ramda"
|
||||||
import {nip05} from "nostr-tools"
|
import {nip05} from "nostr-tools"
|
||||||
import {noop, ensurePlural, chunk} from "hurdak/lib/hurdak"
|
import {noop, ensurePlural, chunk} from "hurdak/lib/hurdak"
|
||||||
import {
|
import {
|
||||||
@ -226,7 +226,20 @@ addHandler(
|
|||||||
|
|
||||||
addHandler(
|
addHandler(
|
||||||
30001,
|
30001,
|
||||||
profileHandler("lists", (e, p) => uniqBy(prop("id"), p.lists.concat(e)))
|
userHandler(e => {
|
||||||
|
const profile = user.getProfile()
|
||||||
|
const listName = Tags.from(e).getMeta("d")
|
||||||
|
const [duplicates, lists] = partition(
|
||||||
|
l => Tags.from(l).getMeta("d") === listName,
|
||||||
|
profile.lists
|
||||||
|
)
|
||||||
|
|
||||||
|
if (e.created_at < duplicates[0]?.created_at) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
user.profile.set({...profile, lists: lists.concat(e)})
|
||||||
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
addHandler(
|
addHandler(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import cx from "classnames"
|
import cx from "classnames"
|
||||||
import type {DynamicFilter} from "src/util/types"
|
import type {DynamicFilter} from "src/util/types"
|
||||||
import {prop, indexBy, objOf} from "ramda"
|
import {indexBy, objOf} from "ramda"
|
||||||
import {Tags} from "src/util/nostr"
|
import {Tags} from "src/util/nostr"
|
||||||
import {modal, theme} from "src/partials/state"
|
import {modal, theme} from "src/partials/state"
|
||||||
import Anchor from "src/partials/Anchor.svelte"
|
import Anchor from "src/partials/Anchor.svelte"
|
||||||
@ -32,14 +32,14 @@
|
|||||||
relays = urls.map(objOf("url"))
|
relays = urls.map(objOf("url"))
|
||||||
}
|
}
|
||||||
|
|
||||||
filter = {kinds: [1, 1985], authors: 'global'}
|
filter = {kinds: [1, 1985], authors: "global"} as DynamicFilter
|
||||||
|
|
||||||
if (authors.length > 0) {
|
if (authors.length > 0) {
|
||||||
filter = {...filter, authors}
|
filter = {...filter, authors}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topics.length > 0) {
|
if (topics.length > 0) {
|
||||||
filter = {...filter, '#t': topics}
|
filter = {...filter, "#t": topics}
|
||||||
}
|
}
|
||||||
|
|
||||||
key = Math.random()
|
key = Math.random()
|
||||||
|
Loading…
Reference in New Issue
Block a user