Publish zap receipts to own relay in addition to requested ones
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Râu Cao 2024-06-19 20:26:24 +02:00
parent 87d900b627
commit cbfa148051
Signed by: raucao
GPG Key ID: 37036C356E56CC51
2 changed files with 19 additions and 1 deletions

View File

@ -6,8 +6,13 @@ module NostrManager
def call def call
tags = parse_tags(@zap.request_event.tags) tags = parse_tags(@zap.request_event.tags)
relays = tags[:relays].take(Setting.nostr_zaps_relay_limit)
tags[:relays].take(Setting.nostr_zaps_relay_limit).each do |relay_url| if Setting.nostr_relay_url.present?
relays << Setting.nostr_relay_url
end
relays.uniq.each do |relay_url|
if @delayed if @delayed
NostrPublishEventJob.perform_later(event: @zap.receipt, relay_url: relay_url) NostrPublishEventJob.perform_later(event: @zap.receipt, relay_url: relay_url)
else else

View File

@ -35,6 +35,19 @@ RSpec.describe NostrManager::PublishZapReceipt, type: :model do
described_class.call(zap: zap) described_class.call(zap: zap)
end end
context "with own relay configured" do
before do
Setting.nostr_relay_url = "wss://foobar.kosmos.org"
end
it "also publishes the receipt to our own relay" do
expect(NostrPublishEventJob).to receive(:perform_later)
.exactly(13).times.and_return(true)
described_class.call(zap: zap)
end
end
end end
end end
end end