diff --git a/app/models/concerns/foreman_notification_send/notification_extensions.rb b/app/models/concerns/foreman_notification_send/notification_extensions.rb index 0faa833b67345a48c6005acae2a7aa7669f8c7fe..a573562253934573ebda252ef13e8228dc06ba72 100644 --- a/app/models/concerns/foreman_notification_send/notification_extensions.rb +++ b/app/models/concerns/foreman_notification_send/notification_extensions.rb @@ -18,8 +18,10 @@ module ForemanNotificationSend sender.send_notification(self) end - NotificationTarget.select { |target| target.should_send?(self) } - .each { |target| target.send(self) } + #NotificationTarget.select { |target| target.should_send?(self) } + # .each { |target| target.send(self) } + rescue StandardError => ex + Foreman::Logging.exception "Failed to send notification #{self}", ex end def level_to_symbol diff --git a/app/services/foreman_notification_send/sender_matrix.rb b/app/services/foreman_notification_send/sender_matrix.rb index 453f1f5caebc79d6fbe79e92e71c25a35b9bff58..65f7247587b5131ca6a21c59ccbb3ef8f091a10f 100644 --- a/app/services/foreman_notification_send/sender_matrix.rb +++ b/app/services/foreman_notification_send/sender_matrix.rb @@ -4,7 +4,8 @@ require 'matrix_sdk/api' module ForemanNotificationSend class SenderMatrix < SenderBase def initialize(hs_url:, access_token:, room:, msgtype: 'm.notice') - raise ArgumentError, 'access_token must be a Matrix room ID/Alias' unless access_token.is_a?(MXID) && access_token.room? + room = MatrixSdk::MXID.new room unless room.is_a?(MatrixSdk::MXID) + raise ArgumentError, 'room must be a Matrix room ID/Alias' unless room.room? @hs_url = hs_url @access_token = access_token diff --git a/foreman_notification_send.gemspec b/foreman_notification_send.gemspec index 579f92e40259f76a29d5e53508d5d31a01b39ced..c45eec8c1895cc52926f2751fc77e35f003a7e4b 100644 --- a/foreman_notification_send.gemspec +++ b/foreman_notification_send.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) } s.require_paths = ['lib'] - s.add_dependency 'matrix_sdk', '~> 1' + s.add_dependency 'matrix_sdk', '~> 2' s.add_development_dependency 'bundler', '~> 1.16' s.add_development_dependency 'minitest', '~> 5.0'