From 4fea447db6ec16fdcc3bbf91bc58e89d2e282d00 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 15 Nov 2018 13:02:46 -0700 Subject: [PATCH] fix context cards for admins who can't read the course list test plan: - enable student context cards feature - create an admin role that has "Users - view list" permission but no permissions on courses - as an admin in that role, go to /courses/X/users - click a student - the context card tray thing should appear (it might not have much in it, but it should appear) fixes ADMIN-2207 Change-Id: I78d86dbe11e0d3ced3490027fd2f48e9da513625 Reviewed-on: https://gerrit.instructure.com/172592 Tested-by: Jenkins Reviewed-by: Carl Kibler QA-Review: Carl Kibler Product-Review: Jeremy Stanley --- app/jsx/context_cards/GraphQLStudentContextTray.js | 13 ++++++++++++- app/jsx/context_cards/StudentContextTray.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/jsx/context_cards/GraphQLStudentContextTray.js b/app/jsx/context_cards/GraphQLStudentContextTray.js index 55d53aa35fe..05d53208f8d 100644 --- a/app/jsx/context_cards/GraphQLStudentContextTray.js +++ b/app/jsx/context_cards/GraphQLStudentContextTray.js @@ -95,13 +95,24 @@ const SCC_QUERY = gql` } ` +// for admins who can view the roster but not the course list +function placeholderCourse(courseId) { + return { + _id: courseId, + permissions: {}, + submissionsConnection: { + edges: [] + } + } +} + export default props => { return ( {({data, loading}) => { const {course, user} = data - return + return }} diff --git a/app/jsx/context_cards/StudentContextTray.js b/app/jsx/context_cards/StudentContextTray.js index 6e1e7a8f0cb..cff932adaa5 100644 --- a/app/jsx/context_cards/StudentContextTray.js +++ b/app/jsx/context_cards/StudentContextTray.js @@ -206,7 +206,7 @@ export default class StudentContextTray extends React.Component {