diff options
author | Stan Hu <stanhu@gmail.com> | 2016-07-23 21:32:18 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-07-23 21:32:18 +0000 |
commit | 03738bdd48d64e30c068df54eaf7e44d21e3c9fa (patch) | |
tree | b1d7c2104aac19968e66cd77c15c2ef9d03bea01 /app | |
parent | 63f39602dadd56da068a81684f73f5415e5ac926 (diff) | |
parent | bfaacb7bccac2b43974ffd527fad3f13a231fb2e (diff) | |
download | gitlab-ce-03738bdd48d64e30c068df54eaf7e44d21e3c9fa.tar.gz |
Merge branch 'nullify-note-type' into 'master'
Fix bug where replies to commit notes displayed in the MR discussion tab wouldn'…
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/20157
See merge request !5446
Diffstat (limited to 'app')
-rw-r--r-- | app/models/note.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index 9b0a7211b4e..b6b2ac6aa42 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -69,7 +69,7 @@ class Note < ActiveRecord::Base project: [:project_members, { group: [:group_members] }]) end - before_validation :clear_blank_line_code! + before_validation :nullify_blank_type, :nullify_blank_line_code after_save :keep_around_commit class << self @@ -217,10 +217,6 @@ class Note < ActiveRecord::Base !system? end - def clear_blank_line_code! - self.line_code = nil if self.line_code.blank? - end - def can_be_award_emoji? noteable.is_a?(Awardable) end @@ -238,4 +234,12 @@ class Note < ActiveRecord::Base def keep_around_commit project.repository.keep_around(self.commit_id) end + + def nullify_blank_type + self.type = nil if self.type.blank? + end + + def nullify_blank_line_code + self.line_code = nil if self.line_code.blank? + end end |