Merge pull request #1078 from SoumyaBhattacharjee/skip_confirmation_for_solution_after_solved

The confirmation dialog should not open after a user has solved the level (Issue: #1077)
This commit is contained in:
Peter Cottle 2023-06-24 10:33:15 -06:00 committed by GitHub
commit b43615446e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -264,6 +264,7 @@ var Level = Sandbox.extend({
var toIssue = this.level.solutionCommand; var toIssue = this.level.solutionCommand;
var issueFunc = function() { var issueFunc = function() {
this.isShowingSolution = true; this.isShowingSolution = true;
this.wasResetAfterSolved = true;
Main.getEventBaton().trigger( Main.getEventBaton().trigger(
'commandSubmitted', 'commandSubmitted',
toIssue toIssue
@ -281,6 +282,7 @@ var Level = Sandbox.extend({
return; return;
} }
if(!LevelStore.isLevelSolved(this.level.id)){
// allow them for force the solution // allow them for force the solution
var confirmDefer = Q.defer(); var confirmDefer = Q.defer();
var dialog = intl.getDialog(require('../dialogs/confirmShowSolution'))[0]; var dialog = intl.getDialog(require('../dialogs/confirmShowSolution'))[0];
@ -300,6 +302,10 @@ var Level = Sandbox.extend({
command.finishWith(deferred); command.finishWith(deferred);
}, confirmView.getAnimationTime()); }, confirmView.getAnimationTime());
}); });
} else {
issueFunc();
command.finishWith(deferred);
}
}, },
toggleObjective: function() { toggleObjective: function() {