Add customer_id to Sentry where relevant

Stephen Paul Weber created

Change summary

web.rb | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

Detailed changes

web.rb 🔗

@@ -165,6 +165,7 @@ class Web < Roda
 						end
 
 						customer_repo.find_by_tel(params["to"]).then do |customer|
+							Sentry.set_user(id: customer.customer_id)
 							CDR.for_inbound(customer.customer_id, params).save
 						end
 					end
@@ -200,6 +201,7 @@ class Web < Roda
 							)
 
 							customer_repo.find_by_tel(params["to"]).then do |customer|
+								Sentry.set_user(id: customer.customer_id)
 								m = Blather::Stanza::Message.new
 								m.chat_state = nil
 								m.from = from_jid
@@ -218,6 +220,7 @@ class Web < Roda
 							next "OK<5" unless duration > 5
 
 							customer_repo.find_by_tel(params["to"]).then do |customer|
+								Sentry.set_user(id: customer.customer_id)
 								m = Blather::Stanza::Message.new
 								m.chat_state = nil
 								m.from = from_jid
@@ -235,6 +238,7 @@ class Web < Roda
 							customer_repo(sgx_repo: Bwmsgsv2Repo.new)
 								.find_by_tel(params["to"])
 								.then { |c|
+									Sentry.set_user(id: c.customer_id)
 									EMPromise.all([c, c.ogm(params["from"])])
 								}.then do |(customer, ogm)|
 									render :voicemail, locals: {
@@ -249,6 +253,7 @@ class Web < Roda
 						customer_repo(
 							sgx_repo: Bwmsgsv2Repo.new
 						).find(params.fetch("customer_id")).then do |customer|
+							Sentry.set_user(id: customer.customer_id)
 							call_attempt_repo.find_inbound(
 								customer,
 								params["from"],
@@ -263,12 +268,12 @@ class Web < Roda
 					customer_repo(
 						sgx_repo: Bwmsgsv2Repo.new
 					).find_by_tel(params["to"]).then { |customer|
+						Sentry.set_user(id: customer.customer_id)
 						EMPromise.all([
 							customer.customer_id,
 							customer.fwd,
 							call_attempt_repo.find_inbound(
-								customer, params["from"],
-								call_id: params["callId"]
+								customer, params["from"], call_id: params["callId"]
 							)
 						])
 					}.then do |(customer_id, fwd, ca)|
@@ -305,6 +310,7 @@ class Web < Roda
 					customer_repo(
 						sgx_repo: Bwmsgsv2Repo.new
 					).find_by_format(from).then do |c|
+						Sentry.set_user(id: c.customer_id)
 						call_attempt_repo.find_outbound(
 							c,
 							params["to"],