Skip to content

Commit 1d34103

Browse files
committed
fix bug where people would not see branding on dashboard
fixes: #CNVS-26358 test plan: * log into canvas (so @current_user exists) * go to the dashboard on a domain where you are not enrolled in anything (if you use pow this could be something like blankaccount.canvas-lms.dev) * you should see blankaccount's branding Change-Id: Ieef00e50eb6cc5c3d09d90441bd257ecf316af99 Reviewed-on: https://gerrit.instructure.com/70055 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins QA-Review: August Thornton <august@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com>
1 parent a3eaf1a commit 1d34103

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

app/helpers/application_helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,11 @@ def brand_config_for_account(opts={})
694694
# if I'm at saltlakeschooldistrict.instructure.com, but I'm only enrolled in classes at
695695
# Highland High, show Highland's branding even on the dashboard.
696696
account = @current_user.common_account_chain(@domain_root_account).last
697-
else
698-
# If we're not logged in, and we're on the dashboard at
699-
# saltlakeschooldistrict.instructure.com, just show it's branding
700-
account = @domain_root_account
701697
end
698+
# If we're not logged in, or we have no enrollments anywhere in domain_root_account,
699+
# and we're on the dashboard at eg: saltlakeschooldistrict.instructure.com, just
700+
# show its branding
701+
account ||= @domain_root_account
702702
end
703703

704704
if account && (brand_config = account.effective_brand_config)

spec/helpers/application_helper_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,13 @@ def set_up_subaccounts
566566
expect(output.scan(%r{https://example.com/(root|child|grandchild)?/account.css})).to eql [['root'], ['child'], ['grandchild']]
567567
end
568568

569+
it "should fall-back to @domain_root_account's branding if I'm logged in but not enrolled in anything" do
570+
@current_user = user
571+
output = helper.include_account_css
572+
expect(output).to have_tag 'link'
573+
expect(output.scan(%r{https://example.com/(root|child|grandchild)?/account.css})).to eql [['root']]
574+
end
575+
569576
it "should include site admin css/js" do
570577
raise pending("need to handle site admin css/js from theme editor: CNVS-25229")
571578
end

0 commit comments

Comments
 (0)