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. * @return True or promise resolved with true if enabled.
*/ */
isEnabled(): boolean | Promise<boolean> { 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; return true;
} }

View File

@ -81,8 +81,8 @@ export class AddonModGlossaryEntryPage {
if (this.glossary && this.glossary.allowcomments && this.entry && this.entry.id > 0 && this.commentsEnabled && if (this.glossary && this.glossary.allowcomments && this.entry && this.entry.id > 0 && this.commentsEnabled &&
this.comments) { this.comments) {
// Refresh comments. Don't add it to promises because we don't want the comments fetch to block the entry fetch. // Refresh comments. Don't add it to promises because we don't want the comments fetch to block the entry fetch.
this.comments.doRefresh().catch(() => { this.comments.doRefresh().catch(() => {
// Ignore errors. // Ignore errors.
}); });
} }

View File

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