siteadmins either see no custom assets
refs FOO-1273 flag=none masquerade to see all custom assets TEST PLAN: 1) visit a custom assets account as siteadmin 2) custom css and js should not render 3) masquerade as a user 4) both custom css and js render Change-Id: I15c9aa00667d3709656566a76f5fc4ea6cb6828e Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254357 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: Ethan Vizitei <evizitei@instructure.com> Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
parent
dfd06c9456
commit
fc2064bdce
|
@ -741,11 +741,6 @@ module ApplicationHelper
|
|||
@current_pseudonym.works_for_account?(brand_config_account, ignore_types: [:site_admin])
|
||||
end
|
||||
|
||||
def has_custom_js
|
||||
@domain_root_account.allow_global_includes? &&
|
||||
active_brand_config(ignore_high_contrast_preference: true)&.css_and_js_overrides&.[](:js_overrides).present?
|
||||
end
|
||||
|
||||
def include_account_js
|
||||
return if params[:global_includes] == '0' || !@domain_root_account
|
||||
return unless pseudonym_can_see_custom_assets
|
||||
|
@ -775,7 +770,7 @@ module ApplicationHelper
|
|||
|
||||
def include_account_css
|
||||
return if disable_account_css?
|
||||
return if has_custom_js && !pseudonym_can_see_custom_assets
|
||||
return unless pseudonym_can_see_custom_assets
|
||||
|
||||
includes = if @domain_root_account.allow_global_includes? && (abc = active_brand_config(ignore_high_contrast_preference: true))
|
||||
abc.css_and_js_overrides[:css_overrides]
|
||||
|
|
|
@ -269,10 +269,9 @@ describe ApplicationHelper do
|
|||
allow(@current_pseudonym).to receive(:works_for_account?).and_return(false)
|
||||
end
|
||||
|
||||
it "still renders if there's no JS" do
|
||||
it "won't render only JS" do
|
||||
allow(helper).to receive(:active_brand_config).and_return BrandConfig.create!(css_overrides: 'https://example.com/path/to/overrides.css')
|
||||
expect(helper.include_account_css).to_not be_nil
|
||||
expect(helper.include_account_css).to match %r{overrides.css}
|
||||
expect(helper.include_account_css).to be_nil
|
||||
end
|
||||
|
||||
it "will not render if there's javacscript" do
|
||||
|
|
Loading…
Reference in New Issue