MOBILE-2525 course: Fix context menu info not updated in modules

main
Dani Palou 2018-07-26 12:19:33 +02:00
parent e6c5607463
commit 12787403d6
2 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
size: string; // Used when calling fillContextMenu.
protected isDestroyed; // Whether the component is destroyed, used when calling fillContextMenu.
protected statusObserver; // Observer of package status changed, used when calling fillContextMenu.
protected contextMenuStatusObserver; // Observer of package status changed, used when calling fillContextMenu.
protected fetchContentDefaultError = 'core.course.errorgetmodule'; // Default error to show when loading contents.
protected isCurrentView: boolean; // Whether the component is in the current view.
@ -193,7 +193,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
*/
ngOnDestroy(): void {
this.isDestroyed = true;
this.statusObserver && this.statusObserver.off();
this.contextMenuStatusObserver && this.contextMenuStatusObserver.off();
}
/**

View File

@ -719,8 +719,8 @@ export class CoreCourseHelperProvider {
}
}
if (typeof instance.statusObserver == 'undefined' && component) {
instance.statusObserver = this.eventsProvider.on(CoreEventsProvider.PACKAGE_STATUS_CHANGED, (data) => {
if (typeof instance.contextMenuStatusObserver == 'undefined' && component) {
instance.contextMenuStatusObserver = this.eventsProvider.on(CoreEventsProvider.PACKAGE_STATUS_CHANGED, (data) => {
if (data.componentId == module.id && data.component == component) {
this.fillContextMenu(instance, module, courseId, false, component);
}