MOBILE-2877 assign: Leave feedback comment enabled

main
Pau Ferrer Ocaña 2019-11-28 14:42:09 +01:00
parent 85b4395909
commit f16042ee7d
3 changed files with 10 additions and 9 deletions

View File

@ -183,6 +183,9 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed
* @return True or promise resolved with true if enabled.
*/
isEnabled(): boolean | Promise<boolean> {
// In here we should check if comments is not disabled in site.
// But due to this is not a common comments place and it can be disabled separately into Moodle (disabling the plugin).
// We are leaving it always enabled. It's also a teacher's feature.
return true;
}

View File

@ -83,14 +83,12 @@ export class CoreCommentsCommentsComponent implements OnChanges, OnDestroy {
// Refresh comments count if event received.
this.commentsCountObserver = eventsProvider.on(CoreCommentsProvider.COMMENTS_COUNT_CHANGED_EVENT, (data) => {
// Verify these comments need to be updated.
if (this.undefinedOrEqual(data, 'contextLevel') && this.undefinedOrEqual(data, 'instanceId') &&
this.undefinedOrEqual(data, 'component') && this.undefinedOrEqual(data, 'itemId') &&
this.undefinedOrEqual(data, 'area') && !this.countError) {
if (!this.commentsCount.endsWith('+')) {
if (!this.commentsCount.endsWith('+') && this.undefinedOrEqual(data, 'contextLevel') &&
this.undefinedOrEqual(data, 'instanceId') && this.undefinedOrEqual(data, 'component') &&
this.undefinedOrEqual(data, 'itemId') && this.undefinedOrEqual(data, 'area') && !this.countError) {
// Parse and unparse string.
this.commentsCount = parseInt(this.commentsCount, 10) + data.countChange + '';
}
}
}, sitesProvider.getCurrentSiteId());
}