FIX: Ruby 3 does not freeze interpolated string (#14567)

FIX: Ruby 3 does not freeze interpolated string (#14567)

Ruby 2.7 or earlier +contents returns self.dup when frozen_string_literal: true. However, Ruby 3.0 returns self because this string is interpolated one, which is not frozen anymore.

This commit uses self.dup to return duplicated string regardless Ruby versions. Feature #17104: Do not freeze interpolated strings when using frozen-string-literal - Ruby master - Ruby Issue Tracking System

diff --git a/app/models/topic_embed.rb b/app/models/topic_embed.rb
index 1e9f06a..502409d 100644
--- a/app/models/topic_embed.rb
+++ b/app/models/topic_embed.rb
@@ -34,7 +34,7 @@ class TopicEmbed < ActiveRecord::Base
       contents = first_paragraph_from(contents)
     end
     contents ||= ''
-    contents = +contents << imported_from_html(url)
+    contents = contents.dup << imported_from_html(url)
 
     url = normalize_url(url)
 

GitHub sha: 2944d2cdd62aa63c2c843e5c92ab38a47cbbadce

This commit appears in #14567 which was approved by SamSaffron. It was merged by SamSaffron.