Publish zap receipts to own relay in addition to requested ones
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
87d900b627
commit
cbfa148051
@ -6,8 +6,13 @@ module NostrManager
|
||||
|
||||
def call
|
||||
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
|
||||
NostrPublishEventJob.perform_later(event: @zap.receipt, relay_url: relay_url)
|
||||
else
|
||||
|
@ -35,6 +35,19 @@ RSpec.describe NostrManager::PublishZapReceipt, type: :model do
|
||||
|
||||
described_class.call(zap: zap)
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user