Skip to content
Snippets Groups Projects
Verified Commit 30c15df6 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Fixup notification sending

parent ce912b64
No related branches found
No related tags found
No related merge requests found
...@@ -18,8 +18,10 @@ module ForemanNotificationSend ...@@ -18,8 +18,10 @@ module ForemanNotificationSend
sender.send_notification(self) sender.send_notification(self)
end end
NotificationTarget.select { |target| target.should_send?(self) } #NotificationTarget.select { |target| target.should_send?(self) }
.each { |target| target.send(self) } # .each { |target| target.send(self) }
rescue StandardError => ex
Foreman::Logging.exception "Failed to send notification #{self}", ex
end end
def level_to_symbol def level_to_symbol
......
...@@ -4,7 +4,8 @@ require 'matrix_sdk/api' ...@@ -4,7 +4,8 @@ require 'matrix_sdk/api'
module ForemanNotificationSend module ForemanNotificationSend
class SenderMatrix < SenderBase class SenderMatrix < SenderBase
def initialize(hs_url:, access_token:, room:, msgtype: 'm.notice') 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 @hs_url = hs_url
@access_token = access_token @access_token = access_token
......
...@@ -17,7 +17,7 @@ Gem::Specification.new do |s| ...@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) } s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
s.require_paths = ['lib'] 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 'bundler', '~> 1.16'
s.add_development_dependency 'minitest', '~> 5.0' s.add_development_dependency 'minitest', '~> 5.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment