diff --git a/met-api/src/met_api/utils/roles.py b/met-api/src/met_api/utils/roles.py
index 34c5b4c89..b7240ccb8 100644
--- a/met-api/src/met_api/utils/roles.py
+++ b/met-api/src/met_api/utils/roles.py
@@ -53,3 +53,4 @@ class Role(Enum):
VIEW_UNAPPROVED_COMMENTS = 'view_unapproved_comments'
VIEW_FEEDBACKS = 'view_feedbacks'
VIEW_ALL_ENGAGEMENTS = 'view_all_engagements' # Allows user access to all engagements including draft
+ SHOW_ALL_COMMENT_STATUS = 'show_all_comment_status' # Allows user to see all comment status
diff --git a/met-web/src/components/engagement/listing/index.tsx b/met-web/src/components/engagement/listing/index.tsx
index 074f19a17..13b52aa82 100644
--- a/met-web/src/components/engagement/listing/index.tsx
+++ b/met-web/src/components/engagement/listing/index.tsx
@@ -73,6 +73,8 @@ const EngagementListing = () => {
const canViewPrivateEngagements = roles.includes(USER_ROLES.VIEW_PRIVATE_ENGAGEMENTS);
+ const canViewAllCommentStatus = roles.includes(USER_ROLES.SHOW_ALL_COMMENT_STATUS);
+
const { page, size, sort_key, nested_sort_key, sort_order } = paginationOptions;
useEffect(() => {
@@ -257,7 +259,8 @@ const EngagementListing = () => {
renderCell: (row: Engagement) => {
if (
!submissionHasBeenOpened(row) ||
- (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id)))
+ (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id))) ||
+ !canViewAllCommentStatus
) {
return <>>;
}
@@ -300,7 +303,8 @@ const EngagementListing = () => {
renderCell: (row: Engagement) => {
if (
!submissionHasBeenOpened(row) ||
- (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id)))
+ (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id))) ||
+ !canViewAllCommentStatus
) {
return <>>;
}
@@ -343,7 +347,8 @@ const EngagementListing = () => {
renderCell: (row: Engagement) => {
if (
!submissionHasBeenOpened(row) ||
- (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id)))
+ (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id))) ||
+ !canViewAllCommentStatus
) {
return <>>;
}
diff --git a/met-web/src/components/survey/listing/Surveys.tsx b/met-web/src/components/survey/listing/Surveys.tsx
index 3f8ef7611..43a8a49c7 100644
--- a/met-web/src/components/survey/listing/Surveys.tsx
+++ b/met-web/src/components/survey/listing/Surveys.tsx
@@ -51,6 +51,8 @@ const Surveys = () => {
const canViewPrivateEngagements = roles.includes(USER_ROLES.VIEW_PRIVATE_ENGAGEMENTS);
+ const canViewAllCommentStatus = roles.includes(USER_ROLES.SHOW_ALL_COMMENT_STATUS);
+
const submissionHasBeenOpened = (survey: Survey) => {
return (
!!survey.engagement &&
@@ -253,7 +255,8 @@ const Surveys = () => {
renderCell: (row: Survey) => {
if (
!submissionHasBeenOpened(row) ||
- (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id)))
+ (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.engagement_id))) ||
+ !canViewAllCommentStatus
) {
return <>>;
}
@@ -295,7 +298,8 @@ const Surveys = () => {
renderCell: (row: Survey) => {
if (
!submissionHasBeenOpened(row) ||
- (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id)))
+ (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.engagement_id))) ||
+ !canViewAllCommentStatus
) {
return <>>;
}
@@ -337,7 +341,8 @@ const Surveys = () => {
renderCell: (row: Survey) => {
if (
!submissionHasBeenOpened(row) ||
- (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.id)))
+ (!canViewPrivateEngagements && !assignedEngagements.includes(Number(row.engagement_id))) ||
+ !canViewAllCommentStatus
) {
return <>>;
}
diff --git a/met-web/src/routes/AuthenticatedRoutes.tsx b/met-web/src/routes/AuthenticatedRoutes.tsx
index 9433a7e36..31f5a0046 100644
--- a/met-web/src/routes/AuthenticatedRoutes.tsx
+++ b/met-web/src/routes/AuthenticatedRoutes.tsx
@@ -36,22 +36,10 @@ const AuthenticatedRoutes = () => {
} />
} />
} />
-
- }
- >
+ }>
} />
-
- }
- >
+ }>
} />
}>
diff --git a/met-web/src/services/userService/constants.ts b/met-web/src/services/userService/constants.ts
index aad4b7aa4..68de89af5 100644
--- a/met-web/src/services/userService/constants.ts
+++ b/met-web/src/services/userService/constants.ts
@@ -26,8 +26,8 @@ export const USER_ROLES = {
EDIT_CLOSED_ENGAGEMENT: 'edit_closed_engagement',
VIEW_ASSIGNED_ENGAGEMENTS: 'view_assigned_engagements',
VIEW_APPROVED_COMMENTS: 'view_approved_comments',
- VIEW_UNAPPROVED_COMMENTS: 'view_unapproved_comments',
APP_ADMIN: 'app-admin',
VIEW_SURVEYS: 'view_surveys',
VIEW_FEEDBACKS: 'view_feedbacks',
+ SHOW_ALL_COMMENT_STATUS: 'show_all_comment_status',
};
diff --git a/met-web/tests/unit/components/comment/CommentListing.test.tsx b/met-web/tests/unit/components/comment/CommentListing.test.tsx
index a2bdf13d1..728766773 100644
--- a/met-web/tests/unit/components/comment/CommentListing.test.tsx
+++ b/met-web/tests/unit/components/comment/CommentListing.test.tsx
@@ -68,7 +68,7 @@ jest.mock('react-redux', () => ({
...jest.requireActual('react-redux'),
useSelector: jest.fn(() => {
return {
- roles: [USER_ROLES.REVIEW_COMMENTS, USER_ROLES.VIEW_UNAPPROVED_COMMENTS],
+ roles: [USER_ROLES.REVIEW_COMMENTS],
assignedEngagements: [mockSurveyOne.engagement_id],
};
}),