From 894abb4999cd41353e09cd53721ef381b8ef504c Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Thu, 3 Jul 2025 13:40:03 +0200 Subject: [PATCH] Normalize legacy experiment descriptions in serializer [SCI-12101] --- app/serializers/lists/experiment_serializer.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/serializers/lists/experiment_serializer.rb b/app/serializers/lists/experiment_serializer.rb index 06c365f66..fdab8e77d 100644 --- a/app/serializers/lists/experiment_serializer.rb +++ b/app/serializers/lists/experiment_serializer.rb @@ -15,9 +15,17 @@ module Lists I18n.l(object.created_at, format: :full_date) end + # normalize description to handle legacy description newlines + def description + # if description includes HTML, it is already in the new format. + return object.description if object.description.match?(/<(.|\n)*?>/) + + simple_format(object.description) + end + def sa_description @user = scope[:user] || @instance_options[:user] - custom_auto_link(object.description, + custom_auto_link(description, simple_format: false, tags: %w(img), team: object.project.team)