Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove inefficient event.journal method

Mir Bhatiaa8276347da73
diff --git a/app/models/activities/event.rb b/app/models/activities/event.rb
index f0c6abda6f2..c27c4793a10 100644
--- a/app/models/activities/event.rb
+++ b/app/models/activities/event.rb
@@ -13,9 +13,5 @@ module Activities
:event_type,
:event_path,
:event_url,
- keyword_init: true) do
- def journal
- @journal ||= Journal.find(event_id)
- end
- end
+ keyword_init: true)
end
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index 8e4af679e92..08d336cdaee 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -46,14 +46,14 @@ See COPYRIGHT and LICENSE files for more details.
(Project: <%= content_tag('span', link_to(e.project.name, e.project), class: 'project') %>)
</div>
<div class="op-project-activity-list--item-subtitle">
- <%= e.journal.initial? ? "created by" : "updated by" %> <%= avatar(e.event_author, size: 'mini') if e.respond_to?(:event_author) %> <span class="spot-caption spot-caption_bold"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span> on <%= format_time(e.event_datetime.to_time, true) %>
+ <%= journal.initial? ? "created by" : "updated by" %> <%= avatar(e.event_author, size: 'mini') if e.respond_to?(:event_author) %> <span class="spot-caption spot-caption_bold"><%= link_to_user(e.event_author) if e.respond_to?(:event_author) %></span> on <%= format_time(e.event_datetime.to_time, true) %>
</div>
<% if e.event_description.present? -%>
<div class="op-project-activity-list--item-description">
<%= truncate_formatted_text(e.event_description) %>
</div>
<% end -%>
- <% unless e.journal.initial? %>
+ <% unless journal.initial? %>
<% if journal.details.any? -%>
<ul class="op-project-activity-list--item-details">
<% journal.details.each do |detail| -%>