diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-03 19:58:58 -0400 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-04 00:11:33 -0400 |
commit | 3286dd7a1db69460573a5fd2c9e997039b1f406b (patch) | |
tree | fba63dd375acb038a1e27f03eb9ba7530578cefd /app/models/sent_notification.rb | |
parent | 0ccdc631e6f45c0fd327631decb47f80d781302e (diff) | |
download | gitlab-ce-3286dd7a1db69460573a5fd2c9e997039b1f406b.tar.gz |
Don't garbage collect commits that have related DB records like comments
Diffstat (limited to 'app/models/sent_notification.rb')
-rw-r--r-- | app/models/sent_notification.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb index 375f195dba7..a2df899d012 100644 --- a/app/models/sent_notification.rb +++ b/app/models/sent_notification.rb @@ -9,6 +9,8 @@ class SentNotification < ActiveRecord::Base validates :commit_id, presence: true, if: :for_commit? validates :line_code, line_code: true, allow_blank: true + after_save :keep_around_commit + class << self def reply_key SecureRandom.hex(16) @@ -67,4 +69,10 @@ class SentNotification < ActiveRecord::Base def to_param self.reply_key end + + private + + def keep_around_commit + project.repository.keep_around(self.commit_id) + end end |