MDL-74084 tool_usertours: ensure presense of tour config in response.

If it's not, then don't try to start the tour. This fix is effectively
the same as that previously made in 3bd9e1e8.

Co-authored-by: Carlos Castillo <carlos.castillo@moodle.com>
This commit is contained in:
Paul Holden 2022-03-08 21:52:30 +00:00
parent f62cd4484e
commit 27adde9b83
3 changed files with 6 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -87,14 +87,12 @@ const fetchTour = async tourId => {
const pendingPromise = new Pending(`admin_usertour_fetchTour:${tourId}`);
try {
// If we don't have any tour config (because it doesn't need showing for the current user), return early.
const response = await tourRepository.fetchTour(tourId);
if (!response.hasOwnProperty('tourconfig')) {
pendingPromise.resolve();
if (response.hasOwnProperty('tourconfig')) {
const {html} = await Templates.renderForPromise('tool_usertours/tourstep', response.tourconfig);
startBootstrapTour(tourId, html, response.tourconfig);
}
const {html} = await Templates.renderForPromise('tool_usertours/tourstep', response.tourconfig);
startBootstrapTour(tourId, html, response.tourconfig);
pendingPromise.resolve();
} catch (error) {
pendingPromise.resolve();