Skip to content

Commit

Permalink
Stop checking for LI
Browse files Browse the repository at this point in the history
  • Loading branch information
zapo committed Dec 17, 2024
1 parent f8c9edb commit bcf17b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 36 deletions.
35 changes: 3 additions & 32 deletions lib/core/regs/consent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,23 @@ describe("getConsent", () => {

// Simulate event where no consent is granted
signal({
publisher: { consents: {}, legitimateInterests: {} },
publisher: { consents: {} },
tcString: "noconsent",
});
expect(consent.deviceAccess).toBe(false);
expect(consent.tcf).toBe("noconsent");

// Simulate event where purpose 1 consent is granted to the publisher
signal({
publisher: { consents: { 1: true }, legitimateInterests: {} },
publisher: { consents: { 1: true } },
tcString: "purpose1",
});
expect(consent.deviceAccess).toBe(true);
expect(consent.tcf).toBe("purpose1");

// Simulate event where purpose 1 consent is legitimate interest to the publisher
signal({
publisher: { consents: {}, legitimateInterests: { 1: true } },
tcString: "purpose1li",
});
expect(consent.deviceAccess).toBe(true);
expect(consent.tcf).toBe("purpose1li");

// Simulate removing consent
signal({
publisher: { consents: {}, legitimateInterests: {} },
publisher: { consents: {} },
tcString: "revoked",
});
expect(consent.deviceAccess).toBe(false);
Expand Down Expand Up @@ -170,7 +162,6 @@ describe("getConsent", () => {
{
SegmentType: 3,
PubPurposesConsent: [],
PubPurposesLITransparency: [],
},
],
},
Expand All @@ -187,7 +178,6 @@ describe("getConsent", () => {
{
SegmentType: 3,
PubPurposesConsent: [1],
PubPurposesLITransparency: [],
},
],
},
Expand All @@ -197,24 +187,6 @@ describe("getConsent", () => {
expect(consent.deviceAccess).toBe(true);
expect(consent.gpp).toBe("purpose1");

// Section tcfeuv2 applies and purpose 1 granted as legitimate interest
// to publisher
signal({
parsedSections: {
[TCFEuV2APIPrefix]: [
{
SegmentType: 3,
PubPurposesConsent: [],
PubPurposesLITransparency: [1],
},
],
},
applicableSections: [TCFEuV2SectionID],
gppString: "purpose1li",
});
expect(consent.deviceAccess).toBe(true);
expect(consent.gpp).toBe("purpose1li");

// Section tcfeuv2 applies and purpose 1 revoked
// to publisher
signal({
Expand All @@ -223,7 +195,6 @@ describe("getConsent", () => {
{
SegmentType: 3,
PubPurposesConsent: [],
PubPurposesLITransparency: [],
},
],
},
Expand Down
6 changes: 2 additions & 4 deletions lib/core/regs/consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,14 @@ function gppEUDeviceAccess(data: GPPConsentData): boolean {
return false;
}

return (
publisherSubsection.PubPurposesConsent.includes(1) || publisherSubsection.PubPurposesLITransparency.includes(1)
);
return publisherSubsection.PubPurposesConsent.includes(1);
}

function tcfDeviceAccess(data: TCFConsentData): boolean {
if (!data.gdprApplies) {
return true;
}
return !!data.publisher.consents["1"] || !!data.publisher.legitimateInterests["1"];
return !!data.publisher.consents["1"];
}

function onGPPSectionChange(sectionID: number, cb: (_: GPPConsentData) => void): void {
Expand Down

0 comments on commit bcf17b3

Please sign in to comment.