From b0904b7d8e37fd9c5047547537c3593926a287f8 Mon Sep 17 00:00:00 2001 From: Lars Liden Date: Thu, 5 Dec 2019 23:18:00 +0000 Subject: [PATCH] fix: bug 2356 (#1404) update train dialog validity flags on replay from train dialog list view --- src/routes/Apps/App/TrainDialogs.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/routes/Apps/App/TrainDialogs.tsx b/src/routes/Apps/App/TrainDialogs.tsx index 8dd19f0b..114b4acd 100644 --- a/src/routes/Apps/App/TrainDialogs.tsx +++ b/src/routes/Apps/App/TrainDialogs.tsx @@ -1071,6 +1071,21 @@ class TrainDialogs extends React.Component { this.props.trainDialogReplayThunkAsync as any, ) + // Get new activities to check for errors or warnings + const teachWithActivities = ((await this.props.fetchActivitiesThunkAsync(this.props.app.appId, newTrainDialog, this.props.user.name, this.props.user.id) as any) as Promise) + const replayError = DialogUtils.getMostSevereReplayError((await teachWithActivities).activities) + if (replayError) { + if (replayError.errorLevel === CLM.ReplayErrorLevel.WARNING) { + newTrainDialog.validity = CLM.Validity.WARNING + } + else { + newTrainDialog.validity = CLM.Validity.INVALID + } + } + else { + newTrainDialog.validity = CLM.Validity.VALID + } + await ((this.props.trainDialogReplaceThunkAsync(this.props.app.appId, trainDialog.trainDialogId, newTrainDialog, false) as any) as Promise) // If user clicks 'Cancel' replay dialogs will be reset