Skip to content

Commit 09a917b

Browse files
authored
Merge pull request #2284 from dpalou/MOBILE-3348
MOBILE-3348 format-text: Re-filter if context data changes
2 parents 187501a + 7256929 commit 09a917b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/addon/mod/glossary/pages/entry/entry.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</ion-refresher>
1010

1111
<core-loading [hideUntil]="loaded">
12-
<ng-container *ngIf="entry">
12+
<ng-container *ngIf="entry && loaded">
1313
<ion-item text-wrap *ngIf="showAuthor">
1414
<ion-avatar core-user-avatar [user]="entry" (click)="openUserProfile(post.userid)" item-start></ion-avatar>
1515
<h2><core-format-text [text]="entry.concept" contextLevel="module" [contextInstanceId]="glossary && glossary.coursemodule" [courseId]="courseId"></core-format-text></h2>

src/directives/format-text.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class CoreFormatTextDirective implements OnChanges {
106106
* Detect changes on input properties.
107107
*/
108108
ngOnChanges(changes: { [name: string]: SimpleChange }): void {
109-
if (changes.text) {
109+
if (changes.text || changes.filter || changes.contextLevel || changes.contextInstanceId) {
110110
this.hideShowMore();
111111
this.formatAndRenderContents();
112112
}
@@ -302,7 +302,7 @@ export class CoreFormatTextDirective implements OnChanges {
302302
return;
303303
} else {
304304
// Open a new state with the contents.
305-
const filter = this.utils.isTrueOrOne(this.filter);
305+
const filter = typeof this.filter != 'undefined' ? this.utils.isTrueOrOne(this.filter) : undefined;
306306

307307
this.textUtils.expandText(this.fullTitle || this.translate.instant('core.description'), this.text,
308308
this.component, this.componentId, undefined, filter, this.contextLevel, this.contextInstanceId, this.courseId);
@@ -413,8 +413,8 @@ export class CoreFormatTextDirective implements OnChanges {
413413
this.contextInstanceId = site.getSiteHomeId();
414414
}
415415

416-
this.filter = typeof this.filter == 'undefined' ?
417-
!!(this.contextLevel && typeof this.contextInstanceId != 'undefined') : !!this.filter;
416+
const filter = typeof this.filter == 'undefined' ?
417+
!!(this.contextLevel && typeof this.contextInstanceId != 'undefined') : this.utils.isTrueOrOne(this.filter);
418418

419419
result.options = {
420420
clean: this.utils.isTrueOrOne(this.clean),
@@ -424,7 +424,7 @@ export class CoreFormatTextDirective implements OnChanges {
424424
wsNotFiltered: this.utils.isTrueOrOne(this.wsNotFiltered)
425425
};
426426

427-
if (this.filter) {
427+
if (filter) {
428428
return this.filterHelper.getFiltersAndFormatText(this.text, this.contextLevel, this.contextInstanceId,
429429
result.options, result.siteId).then((res) => {
430430

0 commit comments

Comments
 (0)