Merge pull request #1440 from dpalou/MOBILE-2525

MOBILE-2525 course: Fix context menu info not updated in modules
main
Juan Leyva 2018-08-21 14:38:45 +01:00 committed by GitHub
commit 2e5b42cc49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}