From f86683922058efba9770a28fe23c0793ec2145ab Mon Sep 17 00:00:00 2001 From: Henri Remonen Date: Mon, 2 Dec 2024 15:24:48 +0200 Subject: [PATCH] refactor: update clientside access right checks to check from array -refs: #1392 --- src/client/pages/FeedbackTarget/FeedbackTargetContext.jsx | 6 +++--- .../pages/FeedbackTarget/tabs/FeedbackView/FeedbackView.jsx | 2 +- src/client/pages/GuestUser/GuestFeedbackTargetView.jsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/pages/FeedbackTarget/FeedbackTargetContext.jsx b/src/client/pages/FeedbackTarget/FeedbackTargetContext.jsx index 91c36bf25..199419abc 100644 --- a/src/client/pages/FeedbackTarget/FeedbackTargetContext.jsx +++ b/src/client/pages/FeedbackTarget/FeedbackTargetContext.jsx @@ -9,9 +9,9 @@ export const FeedbackTargetContextProvider = ({ id, isAdmin, organisation, feedb const orgAccess = organisation?.access const accessStatus = feedbackTarget?.accessStatus - const isResponsibleTeacher = accessStatus === 'RESPONSIBLE_TEACHER' || isAdmin - const isTeacher = accessStatus === 'TEACHER' || isResponsibleTeacher || isAdmin - const isStudent = accessStatus === 'STUDENT' + const isResponsibleTeacher = accessStatus.includes('RESPONSIBLE_TEACHER') || isAdmin + const isTeacher = accessStatus.includes('TEACHER') || isResponsibleTeacher || isAdmin + const isStudent = accessStatus.includes('STUDENT') const isOrganisationAdmin = orgAccess?.admin || isAdmin const isOrganisationReader = orgAccess?.read || isAdmin diff --git a/src/client/pages/FeedbackTarget/tabs/FeedbackView/FeedbackView.jsx b/src/client/pages/FeedbackTarget/tabs/FeedbackView/FeedbackView.jsx index f95ed9603..b175dabed 100644 --- a/src/client/pages/FeedbackTarget/tabs/FeedbackView/FeedbackView.jsx +++ b/src/client/pages/FeedbackTarget/tabs/FeedbackView/FeedbackView.jsx @@ -104,7 +104,7 @@ const FeedbackView = () => { const { language } = i18n const { accessStatus, opensAt, closesAt, feedback, continuousFeedbackEnabled } = feedbackTarget - const isOutsider = accessStatus === 'NONE' + const isOutsider = accessStatus.includes('NONE') const isEnded = feedbackTargetIsEnded(feedbackTarget) const isOpen = feedbackTargetIsOpen(feedbackTarget) const isOngoing = !isOpen && !isEnded diff --git a/src/client/pages/GuestUser/GuestFeedbackTargetView.jsx b/src/client/pages/GuestUser/GuestFeedbackTargetView.jsx index 7dc530e1b..c7150c32e 100644 --- a/src/client/pages/GuestUser/GuestFeedbackTargetView.jsx +++ b/src/client/pages/GuestUser/GuestFeedbackTargetView.jsx @@ -89,7 +89,7 @@ const GuestFeedbackTargetView = () => { const isOpen = feedbackTargetIsOpen(feedbackTarget) const isEnded = feedbackTargetIsEnded(feedbackTarget) const isStarted = new Date() >= new Date(opensAt) - const isTeacher = accessStatus === 'TEACHER' || accessStatus === 'RESPONSIBLE_TEACHER' + const isTeacher = accessStatus.includes('TEACHER') || accessStatus.includes('RESPONSIBLE_TEACHER') const showFeedbacksTab = (isTeacher && isStarted) || feedback || isEnded const coursePeriod = getCoursePeriod(courseRealisation)