Skip to content

Commit 0ecb752

Browse files
authored
SF-3644 Update the project font when it changes on sync (#3587)
1 parent 4bacf18 commit 0ecb752

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/app.component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
113113
private isLoggedInUserAnonymous: boolean = false;
114114
private _selectedProjectDoc?: SFProjectProfileDoc;
115115
private selectedProjectDeleteSub?: Subscription;
116-
private permissionsChangedSub?: Subscription;
116+
private selectedProjectChangedSub?: Subscription;
117117
private _isDrawerPermanent: boolean = true;
118118

119119
constructor(
@@ -343,9 +343,11 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
343343
}
344344
});
345345

346-
this.permissionsChangedSub?.unsubscribe();
347-
this.permissionsChangedSub = this._selectedProjectDoc?.remoteChanges$.subscribe(() => {
346+
this.selectedProjectChangedSub?.unsubscribe();
347+
this.selectedProjectChangedSub = this._selectedProjectDoc?.remoteChanges$.subscribe(() => {
348348
if (this._selectedProjectDoc?.data != null && this.currentUserDoc != null) {
349+
// Ensure the project font is up to date
350+
this.projectFont = this.fontService.getFontFamilyFromProject(this._selectedProjectDoc.data);
349351
// If the user is in the Serval administration area, do not check access, as they will be modifying the
350352
// project's properties. We suppress this in the event log, as if a sync occurs while a serval admin is
351353
// viewing it, it will result in the project deleted dialog erroneously being shown.
@@ -391,7 +393,7 @@ export class AppComponent extends DataLoadingComponent implements OnInit, OnDest
391393

392394
ngOnDestroy(): void {
393395
this.selectedProjectDeleteSub?.unsubscribe();
394-
this.permissionsChangedSub?.unsubscribe();
396+
this.selectedProjectChangedSub?.unsubscribe();
395397
}
396398

397399
setLocale(locale: string): void {

0 commit comments

Comments
 (0)