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 --- spec/controllers/media_controller_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/controllers') diff --git a/spec/controllers/media_controller_spec.rb b/spec/controllers/media_controller_spec.rb index 2925aed59..6651e9d84 100644 --- a/spec/controllers/media_controller_spec.rb +++ b/spec/controllers/media_controller_spec.rb @@ -8,14 +8,14 @@ describe MediaController do describe '#show' do it 'redirects to the file url when attached to a status' do status = Fabricate(:status) - media_attachment = Fabricate(:media_attachment, status: status) + media_attachment = Fabricate(:media_attachment, status: status, shortcode: 'foo') get :show, params: { id: media_attachment.to_param } expect(response).to redirect_to(media_attachment.file.url(:original)) end it 'responds with missing when there is not an attached status' do - media_attachment = Fabricate(:media_attachment, status: nil) + media_attachment = Fabricate(:media_attachment, status: nil, shortcode: 'foo') get :show, params: { id: media_attachment.to_param } expect(response).to have_http_status(404) @@ -29,7 +29,7 @@ describe MediaController do it 'raises when not permitted to view' do status = Fabricate(:status, visibility: :direct) - media_attachment = Fabricate(:media_attachment, status: status) + media_attachment = Fabricate(:media_attachment, status: status, shortcode: 'foo') get :show, params: { id: media_attachment.to_param } expect(response).to have_http_status(404) -- cgit