mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
fix(modals): Show mount modal more often
Fixes #6288. Previously, we used a count of all properties within the user's items.pets.mounts to determine whether or not they'd gained a new mount. That would not work as expected if they had mounts with a null or false status, such as after using the Key to the Kennels. This commit also adds some tests to the inventory controller in Angular for pet raising.
This commit is contained in:
@@ -159,7 +159,7 @@ habitrpg.controller("InventoryCtrl",
|
||||
// Feeding Pet
|
||||
if ($scope.selectedFood) {
|
||||
var food = $scope.selectedFood;
|
||||
var startingMounts = Stats.totalCount(user.items.mounts);
|
||||
var startingMounts = $rootScope.countExists(user.items.mounts);
|
||||
if (food.key === 'Saddle') {
|
||||
if (!$window.confirm(window.env.t('useSaddle', {pet: petDisplayName}))) return;
|
||||
} else if (!$window.confirm(window.env.t('feedPet', {name: petDisplayName, article: food.article, text: food.text()}))) {
|
||||
@@ -169,7 +169,7 @@ habitrpg.controller("InventoryCtrl",
|
||||
$scope.selectedFood = null;
|
||||
|
||||
_updateDropAnimalCount(user.items);
|
||||
if (Stats.totalCount(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
|
||||
if ($rootScope.countExists(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
|
||||
$scope.raisedPet = {
|
||||
displayName: petDisplayName,
|
||||
spriteName: pet,
|
||||
|
||||
Reference in New Issue
Block a user