Skip to content

Commit 9210c3b

Browse files
authored
Merge pull request #2656 from objectcomputing/ad-hoc-template-and-view-checkins
Ad hoc template and view checkins
2 parents c07574a + 77040ff commit 9210c3b

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

web-ui/src/components/feedback_template_selector/FeedbackTemplateSelector.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
9696
creatorId: currentUserId,
9797
active: true,
9898
isAdHoc: true,
99-
isPublic: false
99+
isPublic: false,
100+
isReview: false,
100101
};
101102

102103
const newTemplateQuestion = {
@@ -187,6 +188,7 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
187188
description={template.description}
188189
isAdHoc={template.isAdHoc}
189190
isPublic={template.isPublic}
191+
isReview={template.isReview}
190192
isSelected={query === template.id}
191193
questions={template.questions}
192194
expanded={preview.open}

web-ui/src/components/personnel/Personnel.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { UPDATE_CHECKINS } from '../../context/actions';
77
import {
88
selectCurrentUserId,
99
selectMostRecentCheckin,
10-
selectCsrfToken
10+
selectCsrfToken,
11+
selectCanViewCheckinsPermission,
1112
} from '../../context/selectors';
1213
import Card from '@mui/material/Card';
1314
import CardHeader from '@mui/material/CardHeader';
@@ -53,7 +54,7 @@ const Personnel = () => {
5354
// Get checkins per personnel
5455
useEffect(() => {
5556
async function updateCheckins() {
56-
if (personnel) {
57+
if (personnel && selectCanViewCheckinsPermission(state)) {
5758
for (const person of personnel) {
5859
let res = await getCheckinByMemberId(person.id, csrf);
5960
let data =

web-ui/src/context/AppContext.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import {
2121
getAllMembers,
2222
getAllTerminatedMembers
2323
} from '../api/member';
24+
import {
25+
selectCanViewCheckinsPermission,
26+
} from './selectors';
2427
import { getAllRoles, getAllUserRoles } from '../api/roles';
2528
import { getMemberSkills } from '../api/memberskill';
2629
import { BASE_API_URL } from '../api/api';
@@ -188,7 +191,7 @@ const AppContextProvider = props => {
188191
csrf
189192
) {
190193
getAllCheckinsForAdmin(dispatch, csrf);
191-
} else if (id && csrf) {
194+
} else if (id && csrf && selectCanViewCheckinsPermission(state)) {
192195
getCheckins(id, pdlId, dispatch, csrf);
193196
}
194197
}

web-ui/src/context/selectors.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ export const selectHasSendEmailPermission = hasPermission(
186186
'CAN_SEND_EMAIL'
187187
);
188188

189+
export const selectCanViewCheckinsPermission = hasPermission(
190+
'CAN_VIEW_CHECKINS'
191+
);
192+
189193
export const selectIsPDL = createSelector(
190194
selectUserProfile,
191195
userProfile =>

web-ui/src/pages/CheckinsPage.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
selectCsrfToken,
1313
selectCheckin,
1414
selectProfile,
15-
selectCheckinsForMember
15+
selectCheckinsForMember,
16+
selectCanViewCheckinsPermission,
1617
} from '../context/selectors';
1718
import { getCheckins, createNewCheckin } from '../context/thunks';
1819
import { UPDATE_CHECKIN, UPDATE_TOAST } from '../context/actions';
@@ -72,7 +73,7 @@ const CheckinsPage = () => {
7273
const [tooltipIsOpen, setTooltipIsOpen] = useState(false);
7374

7475
useEffect(() => {
75-
if (selectedProfile) {
76+
if (selectedProfile && selectCanViewCheckinsPermission(state)) {
7677
getCheckins(memberId, selectedProfile.pdlId, dispatch, csrf);
7778
}
7879
}, [memberId, selectedProfile, csrf, dispatch]);

0 commit comments

Comments
 (0)