Change how app title is set so it includes window title
This commit is contained in:
parent
2f1f46eb36
commit
2a3533c747
@ -194,14 +194,4 @@ describe('DashboardComponent', () => {
|
|||||||
>)
|
>)
|
||||||
expect(toastSpy).toHaveBeenCalled()
|
expect(toastSpy).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should get custom app title', () => {
|
|
||||||
const title = 'FooBar'
|
|
||||||
expect(component.subtitle).toContain('Paperless-ngx')
|
|
||||||
expect(component.subtitle).not.toContain(title)
|
|
||||||
jest.spyOn(settingsService, 'get').mockImplementation((key) => {
|
|
||||||
if (key === SETTINGS_KEYS.APP_TITLE) return title
|
|
||||||
})
|
|
||||||
expect(component.subtitle).toContain(title)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
@ -5,13 +5,13 @@ import { ComponentWithPermissions } from '../with-permissions/with-permissions.c
|
|||||||
import { TourService } from 'ngx-ui-tour-ng-bootstrap'
|
import { TourService } from 'ngx-ui-tour-ng-bootstrap'
|
||||||
import { SavedView } from 'src/app/data/saved-view'
|
import { SavedView } from 'src/app/data/saved-view'
|
||||||
import { ToastService } from 'src/app/services/toast.service'
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
|
||||||
import {
|
import {
|
||||||
CdkDragDrop,
|
CdkDragDrop,
|
||||||
CdkDragEnd,
|
CdkDragEnd,
|
||||||
CdkDragStart,
|
CdkDragStart,
|
||||||
moveItemInArray,
|
moveItemInArray,
|
||||||
} from '@angular/cdk/drag-drop'
|
} from '@angular/cdk/drag-drop'
|
||||||
|
import { environment } from 'src/environments/environment'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'pngx-dashboard',
|
selector: 'pngx-dashboard',
|
||||||
@ -34,13 +34,10 @@ export class DashboardComponent extends ComponentWithPermissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get subtitle() {
|
get subtitle() {
|
||||||
const appTitle = this.settingsService.get(SETTINGS_KEYS.APP_TITLE)?.length
|
|
||||||
? this.settingsService.get(SETTINGS_KEYS.APP_TITLE)
|
|
||||||
: 'Paperless-ngx'
|
|
||||||
if (this.settingsService.displayName) {
|
if (this.settingsService.displayName) {
|
||||||
return $localize`Hello ${this.settingsService.displayName}, welcome to ${appTitle}`
|
return $localize`Hello ${this.settingsService.displayName}, welcome to ${environment.appTitle}`
|
||||||
} else {
|
} else {
|
||||||
return $localize`Welcome to ${appTitle}`
|
return $localize`Welcome to ${environment.appTitle}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,4 +301,16 @@ describe('SettingsService', () => {
|
|||||||
.expectOne(`${environment.apiBaseUrl}ui_settings/`)
|
.expectOne(`${environment.apiBaseUrl}ui_settings/`)
|
||||||
.flush(ui_settings)
|
.flush(ui_settings)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should update environment app title if set', () => {
|
||||||
|
const settings = Object.assign({}, ui_settings)
|
||||||
|
settings.settings['app_title'] = 'FooBar'
|
||||||
|
const req = httpTestingController.expectOne(
|
||||||
|
`${environment.apiBaseUrl}ui_settings/`
|
||||||
|
)
|
||||||
|
req.flush(settings)
|
||||||
|
expect(environment.appTitle).toEqual('FooBar')
|
||||||
|
// post for migrate
|
||||||
|
httpTestingController.expectOne(`${environment.apiBaseUrl}ui_settings/`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -270,6 +270,9 @@ export class SettingsService {
|
|||||||
first(),
|
first(),
|
||||||
tap((uisettings) => {
|
tap((uisettings) => {
|
||||||
Object.assign(this.settings, uisettings.settings)
|
Object.assign(this.settings, uisettings.settings)
|
||||||
|
if (this.get(SETTINGS_KEYS.APP_TITLE)?.length) {
|
||||||
|
environment.appTitle = this.get(SETTINGS_KEYS.APP_TITLE)
|
||||||
|
}
|
||||||
this.maybeMigrateSettings()
|
this.maybeMigrateSettings()
|
||||||
// to update lang cookie
|
// to update lang cookie
|
||||||
if (this.settings['language']?.length)
|
if (this.settings['language']?.length)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user