Skip to content

Commit 30e65d3

Browse files
authored
Merge pull request #7152 from Countly/newsletter
[SER-2756] [onboarding] Fix redirection to newsletter page
2 parents c4b3262 + fb3a277 commit 30e65d3

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Version 25.03.X
2+
Fixes:
3+
- [onboarding] Fix redirection to newsletter page
4+
15
## Version 25.03.31
26
Fixes:
37
- [core] Add null checking for user permission when opening the dashboard

frontend/express/public/core/onboarding/javascripts/countly.views.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,6 @@
267267
var countly_newsletter = doc.countly_newsletter;
268268
delete doc.countly_newsletter;
269269

270-
this.$store.dispatch('countlyOnboarding/updateUserNewsletter', {
271-
user_id: countlyGlobal.member._id,
272-
subscribe_newsletter: countly_newsletter,
273-
});
274-
275270
if (countly_newsletter) {
276271
this.$store.dispatch('countlyOnboarding/sendNewsletterSubscription', {
277272
name: countlyGlobal.member.full_name.split(' ')[0],
@@ -280,9 +275,15 @@
280275
});
281276
}
282277

283-
// go home
284-
window.location.href = '#/home';
285-
window.location.reload();
278+
this.$store.dispatch('countlyOnboarding/updateUserNewsletter', {
279+
user_id: countlyGlobal.member._id,
280+
subscribe_newsletter: countly_newsletter,
281+
}).finally(function() {
282+
countlyGlobal.member.subscribe_newsletter = countly_newsletter;
283+
// go home
284+
window.location.href = '#/home';
285+
window.location.reload();
286+
});
286287
},
287288
}
288289
});
@@ -345,12 +346,19 @@
345346
}
346347
});
347348

348-
if (hasNewsLetter && (typeof countlyGlobal.member.subscribe_newsletter !== 'boolean' && !store.get('disable_newsletter_prompt') && (countlyGlobal.member.login_count === 3 || moment().dayOfYear() % 90 === 0))) {
349+
if (
350+
hasNewsLetter &&
351+
(
352+
typeof countlyGlobal.member.subscribe_newsletter !== 'boolean' &&
353+
store.get('disable_newsletter_prompt') === false &&
354+
(countlyGlobal.member.login_count === 3 || moment().dayOfYear() % 90 === 0)
355+
)
356+
) {
349357
if (Backbone.history.fragment !== '/not-subscribed-newsletter' && !/initial-setup|initial-consent/.test(window.location.hash)) {
350358
app.navigate("/not-subscribed-newsletter", true);
351359
}
352360
}
353361
else if (!countlyGlobal.member.subscribe_newsletter && (countlyGlobal.member.login_count !== 3 && moment().dayOfYear() % 90 !== 0)) {
354362
store.set('disable_newsletter_prompt', false);
355363
}
356-
})();
364+
})();

0 commit comments

Comments
 (0)