renalware-core 2.0.17 → 2.0.18

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: 69489313496ac73b284e01c603e89bd3acc20628157094223eb70536c4c688c9
4
- data.tar.gz: a653b932c9d1f872b90999eead2cafa128551a71df247bcc888e9c7788f73ce4
3
+ metadata.gz: d8f98055c0ba3c1fa08f211f731247951b6b819e62c828e743e96962ce7968c6
4
+ data.tar.gz: 6e1bce7c200282e59707e523523f11de57cc8291abf707775fa3a33268c7c136
5
5
  SHA512:
6
- metadata.gz: df3b9fcf4f0f138e2ce2f3f3a43c0962be563e3a39e4ee2acc2fdf22aa95fbe3e7701a60e87c76a9ab6b1f0f83e7963e32d8e9a43cbdf52783aac4523c63cffa
7
- data.tar.gz: 0c78e6dbb66c7821052202c4961ef05a12a9b573998d6d8fed8b3faf6add3132a7ddb19a516cac0d237b96db175e0d8005289a3d36fa824eabb9a613e4e08c16
6
+ metadata.gz: b1c3dca6e10fc4e86ea191ed1331c9aff394599238db64850c3a0b50cbfa5f530f0551a239d0bfb62393bf431f40e79970c96719f9066f772434132fa9eb9910
7
+ data.tar.gz: ca427a97413003d6eaf1992ca8dcbd72b7fb74949232aed5714e3555ae2907439162a09af54de3e13951600b347864685aaea692ee00e9d368f67ba20944ac15
@@ -8,7 +8,7 @@ module Renalware
8
8
  module Letters
9
9
  module Delivery
10
10
  class PracticeMailer < ApplicationMailer
11
- def patient_letter(letter:, to:, recipient:)
11
+ def patient_letter(letter:, to:)
12
12
  validate_letter(letter)
13
13
  letter_presenter = LetterPresenterFactory.new(letter)
14
14
  attachments["letter.pdf"] = Letters::PdfRenderer.call(letter_presenter)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The host app can supply a handler for logging errors in background jobs, like so
4
+ # Renalware::Engine.exception_notifier = MyExceptionNotifier.new
5
+ # where the supplied instance must respond to .notify(exception, **params).
6
+ # Where a handler is not supplied we default to using this null handler.
7
+ class NullExceptionNotifier
8
+ def notify(exception, **_params)
9
+ # noop
10
+ end
11
+ end
@@ -32,7 +32,7 @@ module Renalware
32
32
  end
33
33
 
34
34
  def notify_exception(exception)
35
- ExceptionNotifier.new.notify(exception)
35
+ Engine.exception_notifier.notify(exception)
36
36
  end
37
37
  end
38
38
  end
@@ -31,8 +31,7 @@ module Renalware
31
31
  Letter.transaction do
32
32
  PracticeMailer.patient_letter(
33
33
  letter: letter,
34
- to: practice_email_address,
35
- recipient: nil # TODO
34
+ to: practice_email_address
36
35
  ).deliver_later
37
36
 
38
37
  # Flag as sent
@@ -0,0 +1,7 @@
1
+ module Renalware
2
+ NullUser = Naught.build do |config|
3
+ config.black_hole
4
+ config.define_explicit_conversions
5
+ config.predicates_return false
6
+ end
7
+ end
@@ -4,7 +4,7 @@
4
4
  .row
5
5
  .small-9.large-4.columns
6
6
  = f.label "Name or username contains"
7
- = f.search_field :family_name_or_given_name_or_username_cont
7
+ = f.search_field :family_name_or_given_name_or_username_or_email_cont
8
8
  .small-3.large-4.columns.actions.end
9
9
  = f.submit t("helpers.submit.filter"), class: "button"
10
10
  span= " or "
data/config/routes.rb CHANGED
@@ -21,7 +21,7 @@ Renalware::Engine.routes.draw do
21
21
  get "/session_timed_out" => "session_timeout#has_user_timed_out", as: "session_timed_out"
22
22
 
23
23
  super_admin_constraint = lambda do |request|
24
- current_user = request.env["warden"].user || NullObject.instance
24
+ current_user = request.env["warden"].user || Renalware::NullUser.new
25
25
  current_user.has_role?(:super_admin)
26
26
  end
27
27
 
@@ -65,6 +65,17 @@ module Renalware
65
65
  class Engine < ::Rails::Engine
66
66
  isolate_namespace Renalware
67
67
 
68
+ # Define a attr on the Engine's eigenclass so a host application
69
+ # can set an exception handler instance. It must accept a .notify(excetion) method.
70
+ # We use the exception handler when logging errors in background jobs only.
71
+ # Errors in the UI are bubbled up and handled in the host app in the usual way.
72
+ class << self
73
+ attr_writer :exception_notifier
74
+ def exception_notifier
75
+ @exception_notifier ||= NullExceptionNotifier.new
76
+ end
77
+ end
78
+
68
79
  config.autoload_paths += Dir["#{config.root}/lib/**/"]
69
80
  config.autoload_paths += %W(#{config.root}/app/validators/concerns)
70
81
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.17"
4
+ VERSION = "2.0.18"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.17
4
+ version: 2.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-23 00:00:00.000000000 Z
11
+ date: 2018-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_type
@@ -1300,7 +1300,7 @@ files:
1300
1300
  - app/models/concerns/renalware/personable.rb
1301
1301
  - app/models/concerns/renalware/string_logging.rb
1302
1302
  - app/models/concerns/renalware/supersedeable.rb
1303
- - app/models/exception_notifier.rb
1303
+ - app/models/null_exception_notifier.rb
1304
1304
  - app/models/renalware.rb
1305
1305
  - app/models/renalware/accesses.rb
1306
1306
  - app/models/renalware/accesses/assessment.rb
@@ -1532,6 +1532,7 @@ files:
1532
1532
  - app/models/renalware/modalities/modality.rb
1533
1533
  - app/models/renalware/modalities/pd_to_haemodialysis.rb
1534
1534
  - app/models/renalware/modalities/reason.rb
1535
+ - app/models/renalware/null_user.rb
1535
1536
  - app/models/renalware/pathology.rb
1536
1537
  - app/models/renalware/pathology/all_observation_codes.rb
1537
1538
  - app/models/renalware/pathology/clinic.rb
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Responsible for wrapping a third-party exception notification client. This
4
- # wrapper allows us to switch notification service without affecting the
5
- # rest of the application.
6
- #
7
- class ExceptionNotifier
8
- def notify(exception)
9
- # TODO: add implementation here
10
- end
11
- end