From db57bff11d6a9e101d8aa0adc635367365c83901 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 13 Sep 2021 18:59:37 +0200 Subject: Stop setting a shortcode to newly-created media attachments (#16730) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Stop setting a shortcode to newly-created media attachments The WebUI has stopped using the “short media URL” in ages. This isn't used anywhere except for mail notifications. Deprecating it would allow us to eventually get rid of at least a database column and corruption-prone index, as well as a controller. * Fix tests --- app/serializers/rest/media_attachment_serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/serializers/rest') diff --git a/app/serializers/rest/media_attachment_serializer.rb b/app/serializers/rest/media_attachment_serializer.rb index a24f95315..f27dda832 100644 --- a/app/serializers/rest/media_attachment_serializer.rb +++ b/app/serializers/rest/media_attachment_serializer.rb @@ -40,7 +40,7 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer end def text_url - object.local? ? medium_url(object) : nil + object.local? && object.shortcode.present? ? medium_url(object) : nil end def meta -- cgit