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()
|
||||
})
|
||||
|
||||
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 { SavedView } from 'src/app/data/saved-view'
|
||||
import { ToastService } from 'src/app/services/toast.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import {
|
||||
CdkDragDrop,
|
||||
CdkDragEnd,
|
||||
CdkDragStart,
|
||||
moveItemInArray,
|
||||
} from '@angular/cdk/drag-drop'
|
||||
import { environment } from 'src/environments/environment'
|
||||
|
||||
@Component({
|
||||
selector: 'pngx-dashboard',
|
||||
@ -34,13 +34,10 @@ export class DashboardComponent extends ComponentWithPermissions {
|
||||
}
|
||||
|
||||
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) {
|
||||
return $localize`Hello ${this.settingsService.displayName}, welcome to ${appTitle}`
|
||||
return $localize`Hello ${this.settingsService.displayName}, welcome to ${environment.appTitle}`
|
||||
} else {
|
||||
return $localize`Welcome to ${appTitle}`
|
||||
return $localize`Welcome to ${environment.appTitle}`
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,4 +301,16 @@ describe('SettingsService', () => {
|
||||
.expectOne(`${environment.apiBaseUrl}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(),
|
||||
tap((uisettings) => {
|
||||
Object.assign(this.settings, uisettings.settings)
|
||||
if (this.get(SETTINGS_KEYS.APP_TITLE)?.length) {
|
||||
environment.appTitle = this.get(SETTINGS_KEYS.APP_TITLE)
|
||||
}
|
||||
this.maybeMigrateSettings()
|
||||
// to update lang cookie
|
||||
if (this.settings['language']?.length)
|
||||
|
Loading…
x
Reference in New Issue
Block a user