From c9bbc0b68a072dfde06b457645fda9b229ca3866 Mon Sep 17 00:00:00 2001 From: Qubad786 Date: Tue, 11 Jul 2017 23:50:32 +0500 Subject: [PATCH] Dont fetch caption on getting translations This fixes the endless loop of fetchCaptions ajax requests. fetchCaption on error calls fetchAvailableTranslations which again calls fetchCaption on success and so on. We don't see any significance for calling fetchCaption in fetchAvailableTranslations. --- .../lib/xmodule/xmodule/js/spec/video/video_caption_spec.js | 2 -- common/lib/xmodule/xmodule/js/src/video/09_video_caption.js | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js index 58ad83c0aa..64cba5c692 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js @@ -779,7 +779,6 @@ Caption.fetchAvailableTranslations(); expect($.ajaxWithPrefix).toHaveBeenCalled(); - expect(Caption.fetchCaption).toHaveBeenCalled(); expect(state.config.transcriptLanguages).toEqual({ 'uk': 'Ukrainian', 'de': 'German' @@ -799,7 +798,6 @@ Caption.fetchAvailableTranslations(); expect($.ajaxWithPrefix).toHaveBeenCalled(); - expect(Caption.fetchCaption).not.toHaveBeenCalled(); expect(state.config.transcriptLanguages).toEqual({}); expect(Caption.renderLanguageMenu).not.toHaveBeenCalled(); }); diff --git a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js index 83a4554dab..40599c255a 100644 --- a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js +++ b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js @@ -596,8 +596,8 @@ }, /** - * @desc Fetch the list of available translations. Upon successful receipt, - * the list of available translations will be updated. + * @desc Fetch the list of available language codes. Upon successful receipt + * the list of available languages will be updated. * * @returns {jquery Promise} */ @@ -618,8 +618,6 @@ self.container.find('.langs-list').remove(); if (_.keys(newLanguages).length) { - // And try again to fetch transcript. - self.fetchCaption(); self.renderLanguageMenu(newLanguages); } },