Skip to content

Commit af399ca

Browse files
authored
Merge branch 'master' into beta-new
2 parents c9ae387 + 70c7078 commit af399ca

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

functions/utilities/privacy/utils.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@ const getPrivacyVariant = (user) => {
5959
} catch {
6060
return null;
6161
}
62-
}
62+
}
63+
64+
const shouldRetryPopup = (lastTouched, isUnder13) => {
65+
if (isUnder13) return false;
66+
67+
try {
68+
if (!lastTouched) return false;
69+
const threeHoursAgo = Date.now() - (3 * 60 * 60 * 1000);
70+
return lastTouched < threeHoursAgo;
71+
} catch {
72+
return false;
73+
}
74+
}
6375

6476
const getPrivacyState = (email, user) => {
6577
const isUnder13 = isUnderThirteen(user);
@@ -91,8 +103,11 @@ const getPrivacyState = (email, user) => {
91103

92104
const firstSeen = user[firstSeenKey];
93105
const dueBy = user[dueByKey];
106+
const latestTouch = user[latestTouchKey];
107+
108+
const shouldRetry = shouldRetryPopup(latestTouch, useUnder13);
94109

95-
if (firstSeen && dueBy) {
110+
if (firstSeen && dueBy && !shouldRetry) {
96111
// User has seen popup before
97112

98113
if (Date.now() > dueBy) {

0 commit comments

Comments
 (0)