render account np for users with no enrollments
A user with no enrollments would not be able to render the new account notification preferences page. This change makes it so that the user is returned in the graphql query if the user is the same as the current user. fixes VICE-682 flag=notification_update_account_ui / ---- ---- \ | Test Plan | \ ---- ---- / - Turn on the notificaiton_update_account_ui ff - login as a user with no enrollments - navigate the the account notification preferences page - Note that the page should load correctly Change-Id: I81b9c9daaef58c4b8a50880c1c13f6ceec2c9d3f Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244695 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Rob Orton <rob@instructure.com> QA-Review: Caleb Guanzon <cguanzon@instructure.com> Product-Review: Caleb Guanzon <cguanzon@instructure.com>
This commit is contained in:
parent
d1134f5c57
commit
f50328ff1c
|
@ -42,6 +42,7 @@ module GraphQLNodeLoader
|
|||
return nil unless user && ctx[:current_user]
|
||||
|
||||
return user if user.grants_right?(ctx[:current_user], :read_full_profile)
|
||||
return user if user == ctx[:current_user]
|
||||
|
||||
has_permission = Rails.cache.fetch(["node_user_perm", ctx[:current_user], user].cache_key) do
|
||||
has_perm = Shard.with_each_shard(user.associated_shards & ctx[:current_user].associated_shards) do
|
||||
|
|
|
@ -54,6 +54,13 @@ describe Types::UserType do
|
|||
expect(user_type.resolve("_id", current_user: @other_student)).to eq @student.id.to_s
|
||||
end
|
||||
|
||||
it "works for users without a current enrollment" do
|
||||
user = user_model
|
||||
type = GraphQLTypeTester.new(user, current_user: user, domain_root_account: user.account, request: ActionDispatch::TestRequest.create)
|
||||
expect(type.resolve("_id")).to eq user.id.to_s
|
||||
expect(type.resolve("name")).to eq user.name
|
||||
end
|
||||
|
||||
it "doesn't work for just anyone" do
|
||||
expect(user_type.resolve("_id", current_user: @random_person)).to be_nil
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue