sacrifice differentiating between wp note added and wp edited for speed

Instead of differentiating between the user having added a note and the
user having altered the wp's attributes, we always return the same icon
in the activity.

This allows us to not n+1 fetch the event journal and it's predecessor.
pull/6364/head
Jens Ulferts 6 years ago
parent f6ba46d876
commit f75ae90ad1
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 9
      app/models/activity/work_package_activity_provider.rb

@ -62,14 +62,7 @@ class Activity::WorkPackageActivityProvider < Activity::BaseActivityProvider
end
def event_type(event, _activity)
state = ''
journal = Journal.find(event['event_id'])
if journal.details.empty? && !journal.initial?
state = '-note'
else
state = ActiveRecord::Type::Boolean.new.cast(event['status_closed']) ? '-closed' : '-edit'
end
state = ActiveRecord::Type::Boolean.new.cast(event['status_closed']) ? '-closed' : '-edit'
"work_package#{state}"
end

Loading…
Cancel
Save