* removed reduntand check on assignedusers * update for managed eventtype * formatted * comments * Updated comments * extracted checkForEmptyAssignment and added tests * updated comments * updated to show dialog also when not yet saved * update translations * updated comments * updated translation * updated types * chore: update naming and comments * Delete apps/web/lib/checkForEmptyAssignment.ts deleted since file was renamed * Delete apps/web/test/lib/checkForEmptyAssignment.test.ts deleted as the file is renamed to be more descriptive * update to do teamcheck before * chore: revert name to CheckForEmptyAssignment * updated check conditions * updated useEffect dependencies --------- Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
1 parent
db03e9db20
commit
8508a6f1a0
3 files changed
+171
-41
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import type { EventTypeAssignedUsers, EventTypeHosts } from "~/event-types/views/event-types-single-view";
|
||||
|
||||
// This function checks if EventType requires assignment.
|
||||
// returns true: if EventType requires assignment but there is no assignment yet done by the user.
|
||||
// returns false: for all other scenarios.
|
||||
export function checkForEmptyAssignment({
|
||||
assignedUsers,
|
||||
hosts,
|
||||
isManagedEventType,
|
||||
assignAllTeamMembers,
|
||||
}: {
|
||||
assignedUsers: EventTypeAssignedUsers;
|
||||
hosts: EventTypeHosts;
|
||||
isManagedEventType: boolean;
|
||||
assignAllTeamMembers: boolean;
|
||||
}): boolean {
|
||||
// If Team-events have assignAllTeamMembers checked, return false as assignemnt is complete.
|
||||
if (assignAllTeamMembers) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// For managed eventtype check if assigned users are empty.
|
||||
// For non-managed eventtype check if hosts are empty.
|
||||
if (isManagedEventType ? assignedUsers.length === 0 : hosts.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in new issue
Block a user