mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 19:46:42 +00:00
Fix last_checked again
This commit is contained in:
parent
d4f26abad4
commit
ce19810762
@ -1,5 +1,8 @@
|
|||||||
# Current
|
# Current
|
||||||
|
|
||||||
|
- [ ] Add search for topics
|
||||||
|
- [ ] Fix relay recommendations
|
||||||
|
- [ ] Pagination is slow. Maybe load with no window first, then add since?
|
||||||
- [ ] Add coupon code registration for relay
|
- [ ] Add coupon code registration for relay
|
||||||
- [ ] Repurpose chat as groups
|
- [ ] Repurpose chat as groups
|
||||||
- [ ] Avoid leaking events from private relays
|
- [ ] Avoid leaking events from private relays
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {filter, is, uniq, prop, reject, nth, uniqBy, objOf, pick, identity} from "ramda"
|
import {is, uniq, prop, reject, nth, uniqBy, 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 {
|
||||||
@ -251,12 +251,20 @@ addHandler(
|
|||||||
30078,
|
30078,
|
||||||
profileHandler("last_checked", async (e, p) => {
|
profileHandler("last_checked", async (e, p) => {
|
||||||
if (Tags.from(e).getMeta("d") === "coracle/last_checked/v1") {
|
if (Tags.from(e).getMeta("d") === "coracle/last_checked/v1") {
|
||||||
const updates = filter(
|
const payload = await keys.decryptJson(e.content)
|
||||||
([k, v]) => p.last_checked[k] || 0 < v,
|
const updates = {}
|
||||||
Object.entries(await keys.decryptJson(e.content))
|
for (const k of Object.keys(payload).concat(p.last_checked)) {
|
||||||
)
|
const v = Math.max(payload[k] || 0, p.last_checked[k] || 0)
|
||||||
|
|
||||||
return {...p.last_checked, ...updates}
|
// A bunch of junk got added to this setting. Integer keys, settings, etc
|
||||||
|
if (isNaN(v) || v < 1577836800) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
updates[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
return updates
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user