From f75ae90ad192ab7285d1bb4fe95bfcfd174c68d7 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Mon, 11 Jun 2018 09:20:38 +0200 Subject: [PATCH] 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. --- app/models/activity/work_package_activity_provider.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/models/activity/work_package_activity_provider.rb b/app/models/activity/work_package_activity_provider.rb index cd2eaad99d..b34c6e368d 100644 --- a/app/models/activity/work_package_activity_provider.rb +++ b/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