Commit 0bce9872 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix/allow-accessing-appearance-images' into 'master'

Fixes the 500 for custom apearance header logo and logo

See merge request !11479
parents dda66953 9a15b112
...@@ -21,6 +21,8 @@ class UploadsController < ApplicationController ...@@ -21,6 +21,8 @@ class UploadsController < ApplicationController
can?(current_user, :read_project, model.project) can?(current_user, :read_project, model.project)
when User when User
true true
when Appearance
true
else else
permission = "read_#{model.class.to_s.underscore}".to_sym permission = "read_#{model.class.to_s.underscore}".to_sym
......
---
title: Fixes the 500 when accessing customized appearance logos
merge_request: 11479
author: Alexis Reigel
...@@ -473,5 +473,45 @@ describe UploadsController do ...@@ -473,5 +473,45 @@ describe UploadsController do
end end
end end
end end
context 'Appearance' do
context 'when viewing a custom header logo' do
let!(:appearance) { create :appearance, header_logo: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'), 'image/png') }
context 'when not signed in' do
it 'responds with status 200' do
get :show, model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png'
expect(response).to have_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
get :show, model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png'
response
end
end
end
end
context 'when viewing a custom logo' do
let!(:appearance) { create :appearance, logo: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'), 'image/png') }
context 'when not signed in' do
it 'responds with status 200' do
get :show, model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png'
expect(response).to have_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
get :show, model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png'
response
end
end
end
end
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment