From 5bfea172ee41a2e543d3e0c6846f313769ecbce7 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Tue, 13 Oct 2015 17:01:07 -0400 Subject: [PATCH] fix(notifications): Don't double-modal Corrects behavior of the Notifications controller so that it skips showing the generic levelup modal if it's going to display the quest scroll version. --- .../public/js/controllers/notificationCtrl.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/website/public/js/controllers/notificationCtrl.js b/website/public/js/controllers/notificationCtrl.js index 5e4a4825dd..180dad860e 100644 --- a/website/public/js/controllers/notificationCtrl.js +++ b/website/public/js/controllers/notificationCtrl.js @@ -53,6 +53,15 @@ habitrpg.controller('NotificationCtrl', Notification.mp(mana); }); + $rootScope.$watch('user.stats.lvl', function(after, before) { + if ((after === before) || (User.user._tmp && User.user._tmp.drop && (User.user._tmp.drop.type === 'Quest'))) return; + if (after > before) { + Notification.lvl(); + $rootScope.playSound('Level_Up'); + $rootScope.openModal('levelUp', {controller:'UserCtrl', size:'sm'}); + } + }); + $rootScope.$watch('user._tmp.crit', function(after, before){ if (after == before || !after) return; var amount = User.user._tmp.crit * 100 - 100; @@ -148,15 +157,6 @@ habitrpg.controller('NotificationCtrl', } }); - $rootScope.$watch('user.stats.lvl', function(after, before) { - if (after == before) return; - if (after > before) { - Notification.lvl(); - $rootScope.playSound('Level_Up'); - $rootScope.openModal('levelUp', {controller:'UserCtrl', size:'sm'}); - } - }); - // Completed quest modal $scope.$watch('user.party.quest.completed', function(after, before){ if (!after) return;