mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
bail out and alert user if prize is too high
This commit is contained in:
@@ -114,9 +114,13 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
||||
*/
|
||||
$scope.save = function(challenge) {
|
||||
if (!challenge.group) return alert(window.env.t('selectGroup'));
|
||||
|
||||
var isNew = !challenge._id;
|
||||
$scope.hasEnoughGems(challenge.group);
|
||||
if (!$scope.enoughGems && isNew ) return alert(window.env.t('challengeNotEnoughGems'));
|
||||
|
||||
if(isNew && challenge.prize > $scope.maxPrize) {
|
||||
return alert(window.env.t('challengeNotEnoughGems'));
|
||||
}
|
||||
|
||||
challenge.$save(function(_challenge){
|
||||
if (isNew) {
|
||||
Notification.text(window.env.t('challengeCreated'));
|
||||
|
||||
Reference in New Issue
Block a user