mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Fix zap attribution on notifications page
This commit is contained in:
parent
55d6bbf7f8
commit
e56729a0b5
@ -1,5 +1,6 @@
|
|||||||
# Current
|
# Current
|
||||||
|
|
||||||
|
- [ ] Use submit buttons where relevant
|
||||||
- [ ] Go over onboarding process, suggest some good relays for newcomers
|
- [ ] Go over onboarding process, suggest some good relays for newcomers
|
||||||
- [ ] Submit blog post with new onboarding process built in
|
- [ ] Submit blog post with new onboarding process built in
|
||||||
- [ ] Fix hover on notes in modal
|
- [ ] Fix hover on notes in modal
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {uniq, pick, identity, isEmpty} from 'ramda'
|
import {uniq, pick, identity, isEmpty} from 'ramda'
|
||||||
import {nip05} from 'nostr-tools'
|
import {nip05} from 'nostr-tools'
|
||||||
import {noop, createMap, ensurePlural, chunk, switcherFn} from 'hurdak/lib/hurdak'
|
import {noop, createMap, ensurePlural, chunk, switcherFn} from 'hurdak/lib/hurdak'
|
||||||
import {log} from 'src/util/logger'
|
import {log, warn} from 'src/util/logger'
|
||||||
import {lnurlEncode, lnurlDecode, tryFetch, now, sleep, tryJson, timedelta, shuffle, hash} from 'src/util/misc'
|
import {lnurlEncode, lnurlDecode, tryFetch, now, sleep, tryJson, timedelta, shuffle, hash} from 'src/util/misc'
|
||||||
import {Tags, roomAttrs, personKinds, isRelay, isShareableRelay, normalizeRelayUrl} from 'src/util/nostr'
|
import {Tags, roomAttrs, personKinds, isRelay, isShareableRelay, normalizeRelayUrl} from 'src/util/nostr'
|
||||||
import database from 'src/agent/database'
|
import database from 'src/agent/database'
|
||||||
@ -326,9 +326,11 @@ const verifyZapper = async (pubkey, address) => {
|
|||||||
|
|
||||||
const res = await tryFetch(() => fetch(url))
|
const res = await tryFetch(() => fetch(url))
|
||||||
|
|
||||||
if (res) {
|
try {
|
||||||
zapper = await res.json()
|
zapper = await res.json()
|
||||||
lnurl = lnurlEncode('lnurl', url)
|
lnurl = lnurlEncode('lnurl', url)
|
||||||
|
} catch (e) {
|
||||||
|
warn(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zapper?.allowsNostr && zapper?.nostrPubkey) {
|
if (zapper?.allowsNostr && zapper?.nostrPubkey) {
|
||||||
|
@ -2,7 +2,7 @@ import type {DisplayEvent} from 'src/util/types'
|
|||||||
import {max, find, pluck, propEq, partition, uniq} from 'ramda'
|
import {max, find, pluck, propEq, partition, uniq} from 'ramda'
|
||||||
import {derived} from 'svelte/store'
|
import {derived} from 'svelte/store'
|
||||||
import {createMap} from 'hurdak/lib/hurdak'
|
import {createMap} from 'hurdak/lib/hurdak'
|
||||||
import {synced, now, timedelta} from 'src/util/misc'
|
import {synced, tryJson, now, timedelta} from 'src/util/misc'
|
||||||
import {Tags, personKinds, isAlert, asDisplayEvent, findReplyId} from 'src/util/nostr'
|
import {Tags, personKinds, isAlert, asDisplayEvent, findReplyId} from 'src/util/nostr'
|
||||||
import {getUserReadRelays} from 'src/agent/relays'
|
import {getUserReadRelays} from 'src/agent/relays'
|
||||||
import database from 'src/agent/database'
|
import database from 'src/agent/database'
|
||||||
@ -76,8 +76,12 @@ const processAlerts = async (pubkey, events) => {
|
|||||||
zaps.filter(isPubkeyChild).forEach(e => {
|
zaps.filter(isPubkeyChild).forEach(e => {
|
||||||
const parent = parents[findReplyId(e)]
|
const parent = parents[findReplyId(e)]
|
||||||
const note = asAlert(database.alerts.get(parent.id) || parent)
|
const note = asAlert(database.alerts.get(parent.id) || parent)
|
||||||
|
const meta = Tags.from(e).asMeta()
|
||||||
|
const request = tryJson(() => JSON.parse(meta.description))
|
||||||
|
|
||||||
database.alerts.put({...note, zappedBy: uniq(note.zappedBy.concat(e.pubkey))})
|
if (request) {
|
||||||
|
database.alerts.put({...note, zappedBy: uniq(note.zappedBy.concat(request.pubkey))})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
likes.filter(isPubkeyChild).forEach(e => {
|
likes.filter(isPubkeyChild).forEach(e => {
|
||||||
|
Loading…
Reference in New Issue
Block a user