whoops 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/app/models/whoops/event_group.rb +4 -14
  2. metadata +3 -3
@@ -16,7 +16,6 @@ class Whoops::EventGroup
16
16
 
17
17
  field :last_recorded_at, :type => DateTime
18
18
  field :archived, :type => Boolean, :default => false
19
- field :notify_on_next_occurrence, :type => Boolean, :default => true
20
19
  field :event_count, :type => Integer, :default => 0
21
20
 
22
21
  class << self
@@ -31,10 +30,9 @@ class Whoops::EventGroup
31
30
  end
32
31
 
33
32
  if event_group.valid?
33
+ event_group.send_notifications
34
34
  event_group.archived = false
35
- event_group.handle_archival
36
35
  event_group.event_count += 1
37
- event_group.send_notifications
38
36
  event_group.save
39
37
  end
40
38
 
@@ -55,21 +53,13 @@ class Whoops::EventGroup
55
53
  all.distinct(:service).sort
56
54
  end
57
55
 
58
- def handle_archival
59
- if self.archived_change && !self.new_record?
60
- if self.archived
61
- self.notify_on_next_occurrence = true
62
- else
63
- self.notify_on_next_occurrence = false
64
- end
65
- end
66
- true
56
+ def should_send_notifications?
57
+ (archived || new_record) && Rails.application.config.whoops_sender
67
58
  end
68
59
 
69
60
  def send_notifications
70
- return if !self.notify_on_next_occurrence || !Rails.application.config.whoops_sender
61
+ return unless should_send_notifications?
71
62
  matcher = Whoops::NotificationRule::Matcher.new(self)
72
63
  Whoops::NotificationMailer.event_notification(self, matcher.matches.collect(&:email)).deliver unless matcher.matches.empty?
73
- self.notify_on_next_occurrence = false
74
64
  end
75
65
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whoops
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Higginbotham