Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix view survey on engagement listing when no survey exists #1857

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions met-web/src/components/engagement/listing/ActionsDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ export const ActionsDropDown = ({ engagement }: { engagement: Engagement }) => {
};

const canViewSurvey = (): boolean => {
if (engagement.engagement_status.id === EngagementStatus.Draft) {
return roles.includes(USER_ROLES.VIEW_ALL_SURVEYS) || assignedEngagements.includes(engagement.id);
if (engagement.engagement_status.id !== EngagementStatus.Draft) {
return true;
}

return true;
if (engagement.surveys.length === 0) {
return false;
}

return roles.includes(USER_ROLES.VIEW_ALL_SURVEYS) || assignedEngagements.includes(engagement.id);
};

const ITEMS: ActionDropDownItem[] = useMemo(
Expand Down
Loading