fix masquerading for accounts with custom dashboards

fixes CAT-637

Test plan:
 1. Set a custom dashboard for an account:
    a = Account.find(x)
    a.settings[:dashboard_url] = 'http://some-url'
    a.save!
 2. Clicking the logo in the top left should still take you
    to your custom dashboard, however..
 3. Clicking "Become" on a user's profile page should start
    a masquerading session

Change-Id: Ibe60f2a6fb80b21ca58251f3f02591c1bb7ec9b6
Reviewed-on: https://gerrit.instructure.com/43559
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jeff Belser <jbelser@instructure.com>
Reviewed-by: Jeff Belser <jbelser@instructure.com>
QA-Review: Jeff Belser <jbelser@instructure.com>
Tested-by: Jeff Belser <jbelser@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
This commit is contained in:
Dave Donahue 2014-10-29 22:52:09 -04:00
parent 2aa7668f0c
commit 7515fc76cc
2 changed files with 12 additions and 4 deletions

View File

@ -823,12 +823,12 @@ module ApplicationHelper
end
def dashboard_url(opts={})
return super(opts) if opts[:login_success]
return super(opts) if opts[:login_success] || opts[:become_user_id]
custom_dashboard_url || super(opts)
end
def dashboard_path(opts={})
return super(opts) if opts[:login_success]
return super(opts) if opts[:login_success] || opts[:become_user_id]
custom_dashboard_url || super(opts)
end

View File

@ -477,8 +477,16 @@ describe ApplicationHelper do
expect(dashboard_url).to eq "http://foo.bar"
end
it "with login_success=1, returns a regular canvas dashboard url" do
expect(dashboard_url(:login_success => '1')).to eq "http://test.host/?login_success=1"
context "with login_success=1" do
it "returns a regular canvas dashboard url" do
expect(dashboard_url(:login_success => '1')).to eq "http://test.host/?login_success=1"
end
end
context "with become_user_id=1" do
it "returns a regular canvas dashboard url for masquerading" do
expect(dashboard_url(:become_user_id => '1')).to eq "http://test.host/?become_user_id=1"
end
end
context "with a user logged in" do