diff options
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 2d004a78d..576840843 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -25,6 +25,7 @@ class Issue < ApplicationRecord before_validation :clear_disabled_fields before_save :set_parent_id include Redmine::NestedSet::IssueNestedSet + include Redmine::Reaction::Reactable belongs_to :project belongs_to :tracker @@ -268,7 +269,7 @@ class Issue < ApplicationRecord end alias :base_reload :reload - def reload(*args) + def reload(*) @workflow_rule_by_attribute = nil @assignable_versions = nil @relations = nil @@ -277,7 +278,7 @@ class Issue < ApplicationRecord @total_estimated_hours = nil @last_updated_by = nil @last_notes = nil - base_reload(*args) + base_reload(*) end # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields @@ -469,7 +470,7 @@ class Issue < ApplicationRecord end # Overrides assign_attributes so that project and tracker get assigned first - def assign_attributes(new_attributes, *args) + def assign_attributes(new_attributes, *) return if new_attributes.nil? attrs = new_attributes.dup @@ -480,7 +481,7 @@ class Issue < ApplicationRecord send :"#{attr}=", attrs.delete(attr) end end - super(attrs, *args) + super(attrs, *) end def attributes=(new_attributes) @@ -916,7 +917,8 @@ class Issue < ApplicationRecord result = journals. preload(:details). preload(:user => :email_address). - reorder(:created_on, :id).to_a + reorder(:created_on, :id). + to_a result.each_with_index {|j, i| j.indice = i + 1} @@ -927,6 +929,9 @@ class Issue < ApplicationRecord end Journal.preload_journals_details_custom_fields(result) result.select! {|journal| journal.notes? || journal.visible_details.any?} + + Journal.preload_reaction_details(result) + result end @@ -1170,7 +1175,7 @@ class Issue < ApplicationRecord if leaf? spent_hours else - self_and_descendants.joins(:time_entries).sum("#{TimeEntry.table_name}.hours").to_f || 0.0 + self_and_descendants.joins(:time_entries).sum("#{TimeEntry.table_name}.hours").to_f end end @@ -1203,11 +1208,7 @@ class Issue < ApplicationRecord end def last_notes - if @last_notes - @last_notes - else - journals.visible.where.not(notes: '').reorder(:id => :desc).first.try(:notes) - end + @last_notes || journals.visible.where.not(notes: '').reorder(:id => :desc).first.try(:notes) end # Preloads relations for a collection of issues |