mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 08:21:20 +00:00
Push to projections manually for now
This commit is contained in:
parent
50b2922c1e
commit
86d6f9047f
@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import {nip19} from "nostr-tools"
|
||||
import {toNostrURI} from '@welshman/util'
|
||||
import Popover from "src/partials/Popover.svelte"
|
||||
import OverflowMenu from "src/partials/OverflowMenu.svelte"
|
||||
import {
|
||||
@ -91,7 +92,7 @@
|
||||
const share = () =>
|
||||
router
|
||||
.at("qrcode")
|
||||
.of(nip19.nprofileEncode({pubkey, relays: hints.FromPubkeys([pubkey]).getUrls()}))
|
||||
.of(toNostrURI(nip19.nprofileEncode({pubkey, relays: hints.FromPubkeys([pubkey]).getUrls()})))
|
||||
.open()
|
||||
</script>
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
for (const event of newEvents) {
|
||||
repository.publish(event)
|
||||
projections.push(event)
|
||||
}
|
||||
|
||||
while (projections.buffer.length > 0) {
|
||||
|
@ -61,9 +61,12 @@ import {GroupAccess, RelayMode} from "src/engine/model"
|
||||
// repository, and when accepted, be propagated to projections. This avoids processing
|
||||
// the same event multiple times, since repository deduplicates
|
||||
|
||||
storage.ready.then(() => {
|
||||
repository.on("event", (event: TrustedEvent) => projections.push(event))
|
||||
})
|
||||
// Currently commented out because when storage gets pruned and profiles etc need to be re-loaded,
|
||||
// the event isn't recognized as new by repository and so it doesn't get pushed to projections. TODO
|
||||
|
||||
// storage.ready.then(() => {
|
||||
// repository.on("event", (event: TrustedEvent) => projections.push(event))
|
||||
// })
|
||||
|
||||
// Unwrap gift wraps and send them back to our local relay. They'll then get pushed
|
||||
// back onto projections if they haven't been seen before
|
||||
|
@ -1426,6 +1426,7 @@ export const subscribe = (request: MySubscribeRequest) => {
|
||||
|
||||
sub.emitter.on("event", (url: string, event: TrustedEvent) => {
|
||||
repository.publish(event)
|
||||
projections.push(event)
|
||||
request.onEvent?.(event)
|
||||
})
|
||||
|
||||
@ -1481,6 +1482,9 @@ export const publish = (request: PublishRequest) => {
|
||||
|
||||
const pub = basePublish(request)
|
||||
|
||||
// Add the event to projections
|
||||
projections.push(request.event)
|
||||
|
||||
// Listen to updates and update our publish queue
|
||||
if (isGiftWrap(request.event) || request.event.pubkey === pubkey.get()) {
|
||||
const pubInfo = omit(["emitter", "result"], pub)
|
||||
|
Loading…
Reference in New Issue
Block a user