Skip to content

Commit fc56acd

Browse files
authored
Merge pull request #6074 from bcgov/chore/2598-1
chore(2598): treat additional members as not new if it has other roles
2 parents 24188af + 0c44681 commit fc56acd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/services/db/members-history.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ export async function buildMembersHistory(requests: RequestWithData[]) {
101101
const isNewUser = !userRoles.has(userId);
102102
const hasChanges = prevSorted.length > 0 || filteredNewRoles.length > 0;
103103

104-
const newRoles =
105-
filteredNewRoles.length > 0 ? filteredNewRoles : isNewUser ? ['additional team member without roles'] : [];
104+
let newRoles: string[] = [];
105+
106+
if (filteredNewRoles.length > 0) {
107+
newRoles = filteredNewRoles;
108+
} else if (isNewUser || filteredNewRoles.length === 0) {
109+
newRoles = ['additional team member without roles'];
110+
}
106111

107112
const shouldInclude = hasChanges || isNewUser || diff.items.some((item) => item.userId === userId);
108113

0 commit comments

Comments
 (0)