FIX: Don't even bother checking visit count

This commit is contained in:
Kane York 2015-09-16 15:35:50 -07:00
parent 102b6f6fca
commit e16eebb48c
1 changed files with 0 additions and 20 deletions

View File

@ -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();
} }
}; };