summaryrefslogtreecommitdiff
path: root/app/models/sent_notification.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-08-18 17:02:26 -0700
committerDouwe Maan <douwe@gitlab.com>2015-08-18 17:02:26 -0700
commit8906cabae7a6be44cafcedcaf27352614fcc462b (patch)
tree6ff7220890a5d8e22d16af0daa9689eddd0d4767 /app/models/sent_notification.rb
parenta428838dc00dd95f5dad0e433ad2eb73df2eff0f (diff)
downloadgitlab-ce-8906cabae7a6be44cafcedcaf27352614fcc462b.tar.gz
Changes and stuff.
Diffstat (limited to 'app/models/sent_notification.rb')
-rw-r--r--app/models/sent_notification.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index a3d24669b52..23a1b19ea7c 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -6,8 +6,8 @@ class SentNotification < ActiveRecord::Base
validate :project, :recipient, :reply_key, presence: true
validate :reply_key, uniqueness: true
- validates :noteable_id, presence: true, if: ->(n) { n.noteable_type.present? && n.noteable_type != 'Commit' }
- validates :commit_id, presence: true, if: ->(n) { n.noteable_type == 'Commit' }
+ validates :noteable_id, presence: true, unless: :for_commit?
+ validates :commit_id, presence: true, if: :for_commit?
def self.for(reply_key)
find_by(reply_key: reply_key)
@@ -19,11 +19,9 @@ class SentNotification < ActiveRecord::Base
def noteable
if for_commit?
- project.commit(commit_id)
+ project.commit(commit_id) rescue nil
else
super
end
- rescue
- nil
end
end