diff --git a/src/addons/blog/pages/entries/entries.html b/src/addons/blog/pages/entries/entries.html
index ee8584a08..67120df9f 100644
--- a/src/addons/blog/pages/entries/entries.html
+++ b/src/addons/blog/pages/entries/entries.html
@@ -30,7 +30,7 @@
+ [contextInstanceId]="contextInstanceId" [courseId]="entry.courseid" />
{{ 'addon.blog.' + entry.publishTranslated! | translate}}
@@ -47,8 +47,8 @@
-
+
0">
@@ -57,10 +57,9 @@
-
-
+
+
{{ 'addon.blog.linktooriginalentry' | translate }}
diff --git a/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts b/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts
index fda6ef0a7..bb7931eac 100644
--- a/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts
+++ b/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts
@@ -36,13 +36,11 @@ export class CoreBlockPreRenderedComponent extends CoreBlockBaseComponent implem
* @inheritdoc
*/
async ngOnInit(): Promise {
- await super.ngOnInit();
-
this.courseId = this.contextLevel == 'course' ? this.instanceId : undefined;
-
this.fetchContentDefaultError = 'Error getting ' + this.block.contents?.title + ' data.';
-
this.id = `block-${this.block.instanceid}`;
+
+ await super.ngOnInit();
}
}
diff --git a/src/core/features/filter/services/filter-helper.ts b/src/core/features/filter/services/filter-helper.ts
index 5fe6845af..249cf87f0 100644
--- a/src/core/features/filter/services/filter-helper.ts
+++ b/src/core/features/filter/services/filter-helper.ts
@@ -69,32 +69,6 @@ export class CoreFilterHelperProvider {
});
}
- /**
- * Get the contexts of all blocks in a course.
- *
- * @param courseId Course ID.
- * @param siteId Site ID. If not defined, current site.
- * @returns Promise resolved with the contexts.
- */
- async getBlocksContexts(courseId: number, siteId?: string): Promise {
- // Use stale while revalidate, but always use the first value. If data is updated it will be stored in DB.
- const blocks = await firstValueFrom(CoreCourse.getCourseBlocksObservable(courseId, {
- readingStrategy: CoreSitesReadingStrategy.STALE_WHILE_REVALIDATE,
- siteId,
- }));
-
- const contexts: CoreFiltersGetAvailableInContextWSParamContext[] = [];
-
- blocks.forEach((block) => {
- contexts.push({
- contextlevel: 'block',
- instanceid: block.instanceid,
- });
- });
-
- return contexts;
- }
-
/**
* Get some filters from memory cache. If not in cache, get them and store them in cache.
*
@@ -199,10 +173,14 @@ export class CoreFilterHelperProvider {
async getFilters(
contextLevel: string,
instanceId: number,
- options?: CoreFilterFormatTextOptions,
+ options: CoreFilterFormatTextOptions = {},
siteId?: string,
): Promise {
- options = options || {};
+ // Check the right context to use.
+ const newContext = CoreFilter.convertContext(contextLevel, instanceId, { courseId: options.courseId });
+ contextLevel = newContext.contextLevel;
+ instanceId = newContext.instanceId;
+
options.contextLevel = contextLevel;
options.instanceId = instanceId;
options.filter = false;
@@ -246,11 +224,6 @@ export class CoreFilterHelperProvider {
// If enrolled, get all enrolled courses filters with a single call to decrease number of WS calls.
const getFilters = () => this.getCourseContexts(instanceId, siteId);
- return await this.getCacheableFilters(contextLevel, instanceId, getFilters, options, site);
- } else if (contextLevel == 'block' && courseId && CoreBlockHelper.canGetCourseBlocks(site)) {
- // Get all the course blocks filters with a single call to decrease number of WS calls.
- const getFilters = () => this.getBlocksContexts(courseId, siteId);
-
return await this.getCacheableFilters(contextLevel, instanceId, getFilters, options, site);
}
diff --git a/src/core/features/filter/services/filter.ts b/src/core/features/filter/services/filter.ts
index b2eb8c3ba..9f75d7fad 100644
--- a/src/core/features/filter/services/filter.ts
+++ b/src/core/features/filter/services/filter.ts
@@ -24,6 +24,7 @@ import { makeSingleton } from '@singletons';
import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreLogger } from '@singletons/logger';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
+import { ContextLevel } from '@/core/constants';
/**
* Service to provide filter functionalities.
@@ -162,6 +163,29 @@ export class CoreFilterProvider {
return classified;
}
+ /**
+ * Given a context level and instance ID, return the proper context to use.
+ *
+ * @param contextLevel The context level.
+ * @param instanceId Instance ID related to the context.
+ * @param options Options.
+ * @returns Context to use.
+ */
+ convertContext(
+ contextLevel: string,
+ instanceId: number,
+ options: {courseId?: number} = {},
+ ): {contextLevel: string; instanceId: number} {
+ if (contextLevel === ContextLevel.BLOCK || contextLevel === ContextLevel.USER) {
+ // Blocks and users cannot have specific filters, use the parent context instead.
+ return options.courseId ?
+ { contextLevel: ContextLevel.COURSE, instanceId: options.courseId } :
+ { contextLevel: ContextLevel.SYSTEM, instanceId: 0 };
+ }
+
+ return { contextLevel, instanceId };
+ }
+
/**
* Given some HTML code, this function returns the text as safe HTML.
*
diff --git a/src/core/features/user/pages/about/about.html b/src/core/features/user/pages/about/about.html
index e7b7c6638..6617eae5d 100644
--- a/src/core/features/user/pages/about/about.html
+++ b/src/core/features/user/pages/about/about.html
@@ -29,7 +29,8 @@
-
+