From b0164771ec693ff58504ece560371ffec11f9ca9 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 12 Oct 2015 11:54:46 +0200 Subject: Simplify code around (cross)-references --- app/models/note.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/note.rb') diff --git a/app/models/note.rb b/app/models/note.rb index de3b6df88f7..13eb28f5718 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -358,7 +358,7 @@ class Note < ActiveRecord::Base end def set_references - create_new_cross_references!(project, author) + create_new_cross_references! end def system? -- cgit v1.2.1 From 27d952b1197f2dc615c383c21eb287313d81c74c Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 12 Oct 2015 14:30:44 +0200 Subject: Fix cross-references originating from notes --- app/models/note.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'app/models/note.rb') diff --git a/app/models/note.rb b/app/models/note.rb index 13eb28f5718..ee0c14598f3 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -62,7 +62,6 @@ class Note < ActiveRecord::Base serialize :st_diff before_create :set_diff, if: ->(n) { n.line_code.present? } - after_update :set_references class << self def discussions_from_notes(notes) @@ -333,15 +332,13 @@ class Note < ActiveRecord::Base end def noteable_type_name - if noteable_type.present? - noteable_type.downcase - end + noteable_type.downcase if noteable_type.present? end # FIXME: Hack for polymorphic associations with STI # For more information visit http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Polymorphic+Associations - def noteable_type=(sType) - super(sType.to_s.classify.constantize.base_class.to_s) + def noteable_type=(noteable_type) + super(noteable_type.to_s.classify.constantize.base_class.to_s) end # Reset notes events cache @@ -357,10 +354,6 @@ class Note < ActiveRecord::Base Event.reset_event_cache_for(self) end - def set_references - create_new_cross_references! - end - def system? read_attribute(:system) end -- cgit v1.2.1