mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
fix(onboarding): remove start date restriction
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import moment from 'moment';
|
||||
import {
|
||||
hasActiveOnboarding,
|
||||
hasCompletedOnboarding,
|
||||
onOnboardingComplete,
|
||||
checkOnboardingStatus,
|
||||
@@ -17,19 +16,6 @@ describe('onboarding', () => {
|
||||
user.auth.timestamps.created = moment('2019-12-20').toDate();
|
||||
});
|
||||
|
||||
describe('hasActiveOnboarding', () => {
|
||||
// The value of BEGIN DATE is available in common/script/libs/onboarding
|
||||
|
||||
it('returns true if the account is created after BEGIN_DATE', () => {
|
||||
expect(hasActiveOnboarding(user)).to.eql(true);
|
||||
});
|
||||
|
||||
it('returns false if the account is created before BEGIN_DATE', () => {
|
||||
user.auth.timestamps.created = moment('2019-12-01').toDate();
|
||||
expect(hasActiveOnboarding(user)).to.eql(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasCompletedOnboarding', () => {
|
||||
it('returns false if no achievement has been awarded', () => {
|
||||
const result = hasCompletedOnboarding(user);
|
||||
|
||||
@@ -114,10 +114,7 @@
|
||||
<script>
|
||||
import { mapState, mapActions } from '@/libs/store';
|
||||
import * as quests from '@/../../common/script/content/quests';
|
||||
import {
|
||||
hasCompletedOnboarding,
|
||||
hasActiveOnboarding,
|
||||
} from '@/../../common/script/libs/onboarding';
|
||||
import { hasCompletedOnboarding } from '@/../../common/script/libs/onboarding';
|
||||
import notificationsIcon from '@/assets/svg/notifications.svg';
|
||||
import MenuDropdown from '../ui/customMenuDropdown';
|
||||
import MessageCount from './messageCount';
|
||||
@@ -300,7 +297,7 @@ export default {
|
||||
return this.$store.getters['members:hasClass'](this.user);
|
||||
},
|
||||
showOnboardingGuide () {
|
||||
return hasActiveOnboarding(this.user) && !hasCompletedOnboarding(this.user);
|
||||
return !hasCompletedOnboarding(this.user);
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
import moment from 'moment';
|
||||
|
||||
const BEGIN_DATE = moment('2019-12-18');
|
||||
|
||||
// Only users that signed up after the BEGIN DATE should see the onboarding
|
||||
export function hasActiveOnboarding (user) {
|
||||
return BEGIN_DATE.isBefore(user.auth.timestamps.created);
|
||||
}
|
||||
|
||||
export function hasCompletedOnboarding (user) {
|
||||
return (
|
||||
user.achievements.createdTask === true
|
||||
@@ -24,7 +15,7 @@ export function onOnboardingComplete (user) {
|
||||
|
||||
// Add notification and awards (server)
|
||||
export function checkOnboardingStatus (user, req, analytics) {
|
||||
if (hasActiveOnboarding(user) && hasCompletedOnboarding(user) && user.addNotification) {
|
||||
if (hasCompletedOnboarding(user) && user.addNotification) {
|
||||
user.addNotification('ONBOARDING_COMPLETE');
|
||||
if (analytics) {
|
||||
analytics.track('onboarding complete', {
|
||||
|
||||
Reference in New Issue
Block a user