Skip to content

Commit

Permalink
Merge pull request #285 from IABTechLab/llp-uid2-2721-remove-sharing-…
Browse files Browse the repository at this point in the history
…list-if-no-sharer

Omit participants from sharing table if they're only included by type and don't have SHARER.
  • Loading branch information
lionell-pack-ttd authored Jan 30, 2024
2 parents 7297ca0 + 745480b commit 677ed85
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,15 @@ describe('SharingPermissionsTable', () => {

expect(screen.getByText(/Delete Permissions/i)).toBeInTheDocument();
});

it('shows participants included by site ID even if they are not a valid sharing target', async () => {
render(<SharedWithParticipants />);
expect(await screen.findByText('No SHARER and explicitly included')).toBeInTheDocument();
});

it('does not show participants that are included by group if they are not a valid sharing target', async () => {
render(<SharedWithParticipants />);
await screen.findByText('Site 1');
expect(screen.queryByText('No SHARER and not explicitly included')).not.toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ const response: SharingSiteDTO[] = [
id: 15,
canBeSharedWith: true,
},
{
name: 'No SHARER and not explicitly included',
clientTypes: ['DATA_PROVIDER'],
id: 16,
canBeSharedWith: false,
},
{
name: 'No SHARER and explicitly included',
clientTypes: ['DATA_PROVIDER'],
id: 17,
canBeSharedWith: false,
},
];
const Template: ComponentStory<typeof SharingPermissionsTable> = (args) => (
<TestAllSitesListProvider response={response}>
Expand All @@ -55,7 +67,7 @@ const Template: ComponentStory<typeof SharingPermissionsTable> = (args) => (

export const SharedWithParticipants = Template.bind({});
SharedWithParticipants.args = {
sharedSiteIds: [10, 11, 12, 14, 15],
sharedSiteIds: [10, 11, 12, 14, 15, 17],
sharedTypes: ['DSP', 'DATA_PROVIDER'],
onDeleteSharingPermission: () => Promise.resolve(),
};
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export function SharingPermissionsTable({
const { sites, isLoading } = useAllSitesList();
const getSharingParticipants: () => SharingSiteWithSource[] = () => {
return sites!
.filter((p) => p.canBeSharedWith || sharedSiteIds.includes(p.id))
.map((p) => {
const maybeManualArray: (typeof MANUALLY_ADDED)[] = sharedSiteIds.includes(p.id)
? [MANUALLY_ADDED]
Expand Down

0 comments on commit 677ed85

Please sign in to comment.