Allow non-members to publish zap receipts for members #197

Merged
raucao merged 12 commits from feature/strfry_zap_receipts into master 2024-06-22 17:52:03 +00:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit cbfa148051 - Show all commits

View File

@@ -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

View File

@@ -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