diff options
author | Stan Hu <stanhu@gmail.com> | 2016-07-23 21:32:18 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-25 11:03:42 +0200 |
commit | 7b5fb0ce164bd732e4a6fed508f85a2868bc4bf4 (patch) | |
tree | cedc910cb310c792078e58423ba760d46c1e62cc | |
parent | cba9536b78f50ba68f95689cf7dec119d18eab0a (diff) | |
download | gitlab-ce-7b5fb0ce164bd732e4a6fed508f85a2868bc4bf4.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
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/note.rb | 14 | ||||
-rw-r--r-- | db/migrate/20160722221922_nullify_blank_type_on_notes.rb | 9 |
3 files changed, 19 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG index 6a9fa00e547..b94e655495d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ v 8.10.1 (unreleased) - Gracefully handle case when keep-around references are corrupted or exist already. !5430 - Add detailed info on storage path mountpoints. !5437 - Fix Error 500 when creating Wiki pages with hyphens or spaces. !5444 + - Fix bug where replies to commit notes displayed in the MR discussion tab wouldn't show up on the commit page. !5446 v 8.10.0 - Fix profile activity heatmap to show correct day name (eanplatter) diff --git a/app/models/note.rb b/app/models/note.rb index 0ce10c77de9..88c8e3afcc1 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 @@ -216,10 +216,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 @@ -237,4 +233,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 diff --git a/db/migrate/20160722221922_nullify_blank_type_on_notes.rb b/db/migrate/20160722221922_nullify_blank_type_on_notes.rb new file mode 100644 index 00000000000..c4b78e8e15c --- /dev/null +++ b/db/migrate/20160722221922_nullify_blank_type_on_notes.rb @@ -0,0 +1,9 @@ +class NullifyBlankTypeOnNotes < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + execute "UPDATE notes SET type = NULL WHERE type = ''" + end +end |