From 825184ab1b062797997d898ecef21df5eef7d3fb Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Mon, 3 Nov 2025 07:30:23 +0100 Subject: [PATCH] Memoize since these are invoked several times --- app/models/concerns/attachments.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/attachments.rb b/app/models/concerns/attachments.rb index d30496165..1d1c2c4d6 100644 --- a/app/models/concerns/attachments.rb +++ b/app/models/concerns/attachments.rb @@ -29,7 +29,7 @@ module Attachments end def remote_images - rich_text_record&.body&.attachables&.grep(ActionText::Attachables::RemoteImage) || [] + @remote_images ||= rich_text_record&.body&.attachables&.grep(ActionText::Attachables::RemoteImage) || [] end def has_remote_images? @@ -37,7 +37,7 @@ module Attachments end def remote_videos - rich_text_record&.body&.attachables&.grep(ActionText::Attachables::RemoteVideo) || [] + @remote_videos ||= rich_text_record&.body&.attachables&.grep(ActionText::Attachables::RemoteVideo) || [] end def has_remote_videos?