Commit 210ce8ac5a419cb19e456cb50f2a2a17a4e7d68b
1 parent
4d15bc80
Exists in
master
and in
1 other branch
interval field if desired filtered through to all subs
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
app/models/notification_service.rb
| @@ -11,11 +11,26 @@ class NotificationService | @@ -11,11 +11,26 @@ class NotificationService | ||
| 11 | field :api_token, :type => String | 11 | field :api_token, :type => String |
| 12 | field :subdomain, :type => String | 12 | field :subdomain, :type => String |
| 13 | field :sender_name, :type => String | 13 | field :sender_name, :type => String |
| 14 | + field :notify_at_notices, :type => Array, :default => Errbit::Config.notify_at_notices | ||
| 14 | 15 | ||
| 15 | embedded_in :app, :inverse_of => :notification_service | 16 | embedded_in :app, :inverse_of => :notification_service |
| 16 | 17 | ||
| 17 | validate :check_params | 18 | validate :check_params |
| 18 | 19 | ||
| 20 | + if Errbit::Config.per_app_notify_at_notices | ||
| 21 | + Fields = [[:notify_at_notices, | ||
| 22 | + { :placeholder => 'comma separated numbers or simply 0 for every notice', | ||
| 23 | + :label => 'notify on errors (0 for all errors)' | ||
| 24 | + } | ||
| 25 | + ]] | ||
| 26 | + else | ||
| 27 | + Fields = [] | ||
| 28 | + end | ||
| 29 | + | ||
| 30 | + def notify_at_notices | ||
| 31 | + Errbit::Config.per_app_notify_at_notices ? super : Errbit::Config.notify_at_notices | ||
| 32 | + end | ||
| 33 | + | ||
| 19 | # Subclasses are responsible for overwriting this method. | 34 | # Subclasses are responsible for overwriting this method. |
| 20 | def check_params; true; end | 35 | def check_params; true; end |
| 21 | 36 |