pager_tree-integrations 1.1.5 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48ec1c4823f433b06f6d208be7148941457bfd8e62abe4f8bd5daf7ff502cc4a
4
- data.tar.gz: a13190685045dd29141360b31e232e40a7fe9628ccbdbf707047cfad3a25ef1f
3
+ metadata.gz: 42e8ce6133c42b2f55fe684aa15e588e032ba1a36957a6b96e323775bc34bb16
4
+ data.tar.gz: 6c0d6a23f3d4bc57c39e07e6eced049d8f7c54ff8fc6171d273abcc221438d17
5
5
  SHA512:
6
- metadata.gz: 95cab16e6759fc7b013e6ab16611d6c1441503b688e8e26a201adcc3647dbfe63e557b6a80b429288278014fcb9bb2993f736de2687ef2fc9b3e039cc325a650
7
- data.tar.gz: b77187a86484fe1e6e75f42dfb00c33f622d103b8d4956d0603e24869ee672a96c52b0415371f6b35e85d04005e23f8977ae3445107ea6908b507b8d48a4e244
6
+ metadata.gz: ff070b2a45a5d78a5542a91784e6e8411bd8670f213a669febcde1057e84c1fab92e48f335ff05a839b68f7a94133d27d967bd902c64cd308efc727608e118dd
7
+ data.tar.gz: 3a02d1d7458a527c93c1095c0b4eb64697d1c24bcaf3563b2f0ed1bf4fa5fb3d92e5712a182d6d69072ec8587ed89cd2677053f3f7ab2a44c46cdff07f1faa0e
@@ -83,7 +83,7 @@ module PagerTree::Integrations
83
83
  end
84
84
 
85
85
  def validate_record_emails
86
- errors.add(:record_emails, "must be a valid email") if option_record_emails.any? { |x| !x.match(URI::MailTo::EMAIL_REGEXP) }
86
+ errors.add(:record_emails, "must be a valid email") if option_record_emails.any? { |x| !(x.match(URI::MailTo::EMAIL_REGEXP) || ["team", "team-admin", "on-call"].include?(x)) }
87
87
  end
88
88
 
89
89
  def adapter_supports_incoming?
@@ -229,8 +229,24 @@ module PagerTree::Integrations
229
229
 
230
230
  adapter_alert.logs.create!(message: "Caller left a <a href='#{recording_url}' target='_blank'>voicemail</a>.")
231
231
 
232
- option_record_emails.each do |email|
233
- LiveCallRouting::Twilio::V3Mailer.with(email: email, alert: adapter_alert, from: adapter_incoming_request_params.dig("From"), recording_url: recording_url).call_recording.deliver_later
232
+ if option_record_emails.any?
233
+ emails = option_record_emails.map do |x|
234
+ if x == "team"
235
+ Array(adapter_alert.destination_teams.map(&:admin_users).flatten&.map(&:email)) + Array(adapter_alert.destination_teams.map(&:member_users).flatten&.map(&:email))
236
+ elsif x == "team-admin"
237
+ Array(adapter_alert.destination_teams.map(&:admin_users).flatten&.map(&:email))
238
+ elsif x == "on-call"
239
+ adapter_alert.destination_teams.map do |t|
240
+ Array(t.schedule.current_oncall_event_occurrences.map(&:attendees).flatten.map(&:attendee).uniq.map(&:email))
241
+ end
242
+ else
243
+ x
244
+ end
245
+ end.flatten.compact_blank.uniq
246
+
247
+ emails.each do |email|
248
+ LiveCallRouting::Twilio::V3Mailer.with(email: email, alert: adapter_alert, from: adapter_incoming_request_params.dig("From"), recording_url: recording_url).call_recording.deliver_later
249
+ end
234
250
  end
235
251
  elsif option_record
236
252
  _twiml.play(url: option_no_answer_media_url)
@@ -1,5 +1,5 @@
1
1
  module PagerTree
2
2
  module Integrations
3
- VERSION = "1.1.5"
3
+ VERSION = "1.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pager_tree-integrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Miller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-03 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails