From ac62de7bd8861c02d2eaed392288f918c16a1a91 Mon Sep 17 00:00:00 2001 From: Fiz <34069775+Hafizzle@users.noreply.github.com> Date: Tue, 4 Nov 2025 15:38:10 -0600 Subject: [PATCH] Show orb of rebirth confirmation modal after use (window refresh) (#15540) * fix(content): textual tweaks and updates * fix(link): direct to FAQ instead of wiki * fix(faq): correct Markdown * Show orb of rebirth confirmation modal after use (window refresh) * Set and check rebirth confirmation modal from localstorage Set and check rebirth confirmation modal from localstorage after window reload * Don't show orb of rebirth confirmation modal until page reloads --------- Co-authored-by: Kalista Payne --- .../client/src/components/notifications.vue | 37 ++++++++++++++++++- .../client/src/components/shops/buyModal.vue | 7 +++- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/website/client/src/components/notifications.vue b/website/client/src/components/notifications.vue index 4f19cda6cd..2639680d48 100644 --- a/website/client/src/components/notifications.vue +++ b/website/client/src/components/notifications.vue @@ -328,6 +328,8 @@ export default { alreadyReadNotification, nextCron: null, handledNotifications, + isInitialLoadComplete: false, + pendingRebirthNotification: null, }; }, computed: { @@ -453,6 +455,18 @@ export default { return this.runYesterDailies(); }, + async showPendingRebirthModal () { + if (this.pendingRebirthNotification) { + this.playSound('Achievement_Unlocked'); + this.$root.$emit('bv::show::modal', 'rebirth'); + + await axios.post('/api/v4/notifications/read', { + notificationIds: [this.pendingRebirthNotification.id], + }); + + this.pendingRebirthNotification = null; + } + }, showDeathModal () { this.playSound('Death'); this.$root.$emit('bv::show::modal', 'death'); @@ -661,6 +675,18 @@ export default { this.showLevelUpNotifications(this.user.stats.lvl); } this.handleUserNotifications(this.user.notifications); + + this.isInitialLoadComplete = true; + + const hasRebirthConfirmationFlag = localStorage.getItem('show-rebirth-confirmation') === 'true'; + + if (hasRebirthConfirmationFlag) { + localStorage.removeItem('show-rebirth-confirmation'); + this.playSound('Achievement_Unlocked'); + this.$root.$emit('bv::show::modal', 'rebirth'); + } else { + this.showPendingRebirthModal(); + } }, async handleUserNotifications (after) { if (this.$store.state.isRunningYesterdailies) return; @@ -700,8 +726,15 @@ export default { this.$root.$emit('habitica:won-challenge', notification); break; case 'REBIRTH_ACHIEVEMENT': - this.playSound('Achievement_Unlocked'); - this.$root.$emit('bv::show::modal', 'rebirth'); + if (localStorage.getItem('show-rebirth-confirmation') === 'true') { + markAsRead = false; + } else if (!this.isInitialLoadComplete) { + this.pendingRebirthNotification = notification; + markAsRead = false; + } else { + this.playSound('Achievement_Unlocked'); + this.$root.$emit('bv::show::modal', 'rebirth'); + } break; case 'STREAK_ACHIEVEMENT': this.text(`${this.$t('streaks')}: ${this.user.achievements.streak}`, () => { diff --git a/website/client/src/components/shops/buyModal.vue b/website/client/src/components/shops/buyModal.vue index 58128c37bc..16876a816b 100644 --- a/website/client/src/components/shops/buyModal.vue +++ b/website/client/src/components/shops/buyModal.vue @@ -873,8 +873,13 @@ export default { return; } if (this.genericPurchase) { + if (this.item.key === 'rebirth_orb') { + localStorage.setItem('show-rebirth-confirmation', 'true'); + } await this.makeGenericPurchase(this.item, 'buyModal', this.selectedAmountToBuy); - await this.purchased(this.item.text); + if (this.item.key !== 'rebirth_orb') { + await this.purchased(this.item.text); + } } }