mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 22:39:36 +08:00
FIX: Don't even bother checking visit count
This commit is contained in:
parent
102b6f6fca
commit
e16eebb48c
|
@ -3,7 +3,6 @@ import Session from 'discourse/models/session';
|
||||||
|
|
||||||
const ANON_TOPIC_IDS = 3,
|
const ANON_TOPIC_IDS = 3,
|
||||||
ANON_PROMPT_READ_TIME = 5 * 60 * 1000,
|
ANON_PROMPT_READ_TIME = 5 * 60 * 1000,
|
||||||
ANON_PROMPT_VISIT_COUNT = 1,
|
|
||||||
ONE_DAY = 24 * 60 * 60 * 1000,
|
ONE_DAY = 24 * 60 * 60 * 1000,
|
||||||
PROMPT_HIDE_DURATION = ONE_DAY;
|
PROMPT_HIDE_DURATION = ONE_DAY;
|
||||||
|
|
||||||
|
@ -48,11 +47,6 @@ export default {
|
||||||
return; // hidden in last 24 hours
|
return; // hidden in last 24 hours
|
||||||
}
|
}
|
||||||
|
|
||||||
const visitCount = keyValueStore.getInt('anon-visit-count');
|
|
||||||
if (visitCount < ANON_PROMPT_VISIT_COUNT) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const readTime = keyValueStore.getInt('anon-topic-time');
|
const readTime = keyValueStore.getInt('anon-topic-time');
|
||||||
if (readTime < ANON_PROMPT_READ_TIME) {
|
if (readTime < ANON_PROMPT_READ_TIME) {
|
||||||
return;
|
return;
|
||||||
|
@ -71,20 +65,6 @@ export default {
|
||||||
|
|
||||||
screenTrack.set('anonFlushCallback', checkSignupCtaRequirements);
|
screenTrack.set('anonFlushCallback', checkSignupCtaRequirements);
|
||||||
|
|
||||||
// Record a visit
|
|
||||||
const nowVisit = new Date().getTime();
|
|
||||||
const lastVisit = keyValueStore.getInt('anon-last-visit', 0);
|
|
||||||
if (!lastVisit) {
|
|
||||||
// First visit
|
|
||||||
keyValueStore.setItem('anon-visit-count', 1);
|
|
||||||
keyValueStore.setItem('anon-last-visit', nowVisit);
|
|
||||||
} else if (nowVisit - lastVisit > ONE_DAY) {
|
|
||||||
// More than a day
|
|
||||||
const visitCount = keyValueStore.getInt('anon-visit-count', 1);
|
|
||||||
keyValueStore.setItem('anon-visit-count', visitCount + 1);
|
|
||||||
keyValueStore.setItem('anon-last-visit', nowVisit);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSignupCtaRequirements();
|
checkSignupCtaRequirements();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user