From e9c49297264910f22cd4474426fef85d21330524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 27 Sep 2023 12:39:35 +0200 Subject: [PATCH] Fix XMPP from-address config not being used --- app/controllers/webhooks_controller.rb | 2 +- spec/requests/webhooks_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb index 30470e1..e3657c1 100644 --- a/app/controllers/webhooks_controller.rb +++ b/app/controllers/webhooks_controller.rb @@ -30,7 +30,7 @@ class WebhooksController < ApplicationController def notify_xmpp(address, amt_sats, memo) payload = { type: "normal", - from: Setting.primary_domain, + from: Setting.xmpp_notifications_from_address, to: address, subject: "Sats received!", body: "#{helpers.number_with_delimiter amt_sats} sats received in your Lightning wallet:\n> #{memo}" diff --git a/spec/requests/webhooks_spec.rb b/spec/requests/webhooks_spec.rb index 96a3b8f..c7d826d 100644 --- a/spec/requests/webhooks_spec.rb +++ b/spec/requests/webhooks_spec.rb @@ -68,6 +68,7 @@ RSpec.describe "Webhooks", type: :request do context "notification preference set to 'xmpp'" do before do + Setting.xmpp_notifications_from_address = "botka@kosmos.org" user.update! preferences: { lightning_notify_sats_received: "xmpp" } post "/webhooks/lndhub", params: payload.to_json end @@ -78,7 +79,7 @@ RSpec.describe "Webhooks", type: :request do msg = enqueued_jobs.first["arguments"].first expect(msg["type"]).to eq("normal") - expect(msg["from"]).to eq("kosmos.org") + expect(msg["from"]).to eq("botka@kosmos.org") expect(msg["to"]).to eq(user.address) expect(msg["subject"]).to eq("Sats received!") expect(msg["body"]).to match(/^12,300 sats received/)