mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-20 12:36:53 +00:00
Add a way to dismiss the new pill
This commit is contained in:
3 files changed
+41
-6
No files matched your search
@@ -389,8 +389,14 @@
|
||||
{{ versionString }}
|
||||
</button>
|
||||
@if (settingsService.unseenReleasesSince()) {
|
||||
<button type="button" class="btn btn-whats-new rounded-pill smaller ms-1 py-1 px-2 fw-bold lh-sm align-baseline" (click)="showReleaseNotes()"
|
||||
title="See what's new in this version" i18n-title i18n>New</button>
|
||||
<div class="btn-group ms-2 align-baseline">
|
||||
<button type="button" class="btn btn-whats-new rounded-start-pill smaller py-1 px-2 fw-bold lh-sm" (click)="showReleaseNotes()"
|
||||
title="See what's new in this version" i18n-title i18n>New</button>
|
||||
<button type="button" class="btn btn-whats-new rounded-end-pill smaller py-1 px-1 lh-sm d-flex align-items-center" (click)="dismissReleaseNotes()"
|
||||
title="Dismiss" i18n-title aria-label="Dismiss" i18n-aria-label>
|
||||
<pngx-bs-icon name="x" class="d-flex" width="1em" height="1em"></pngx-bs-icon>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (!settingsService.updateCheckingIsSet || appRemoteVersion()) {
|
||||
|
||||
@@ -723,6 +723,30 @@ describe('AppFrameComponent', () => {
|
||||
).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should dismiss new release pill without opening release notes', () => {
|
||||
settingsService.set(SETTINGS_KEYS.VERSION, '3.5.1')
|
||||
settingsService.set(SETTINGS_KEYS.WHATS_NEW_LAST_SEEN_VERSION, '3.4.2')
|
||||
fixture.detectChanges()
|
||||
const modalSpy = jest.spyOn(modalService, 'open')
|
||||
|
||||
fixture.debugElement
|
||||
.query(By.css('button[aria-label="Dismiss"]'))
|
||||
.nativeElement.click()
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}ui_settings/`
|
||||
)
|
||||
expect(req.request.body.settings.whats_new.last_seen_version).toEqual(
|
||||
'3.5.1'
|
||||
)
|
||||
req.flush({ success: true })
|
||||
fixture.detectChanges()
|
||||
|
||||
expect(modalSpy).not.toHaveBeenCalled()
|
||||
expect(
|
||||
fixture.debugElement.query(By.css('button[aria-label="Dismiss"]'))
|
||||
).toBeNull()
|
||||
})
|
||||
|
||||
it('should open current release notes from the version without marking seen', () => {
|
||||
settingsService.set(SETTINGS_KEYS.VERSION, '3.5.1')
|
||||
settingsService.set(SETTINGS_KEYS.WHATS_NEW_LAST_SEEN_VERSION, '3.5.1')
|
||||
|
||||
@@ -570,13 +570,18 @@ export class AppFrameComponent
|
||||
const since = this.settingsService.unseenReleasesSince()
|
||||
this.openReleaseNotes(since)
|
||||
if (since) {
|
||||
this.settingsService
|
||||
.markReleasesSeen()
|
||||
.pipe(first())
|
||||
.subscribe({ error: () => {} })
|
||||
this.dismissReleaseNotes()
|
||||
}
|
||||
}
|
||||
|
||||
/** Mark the running version's release notes seen, hiding "New" */
|
||||
dismissReleaseNotes() {
|
||||
this.settingsService
|
||||
.markReleasesSeen()
|
||||
.pipe(first())
|
||||
.subscribe({ error: () => {} })
|
||||
}
|
||||
|
||||
/** Notes for releases newer than the running version, not yet installed */
|
||||
showAvailableReleaseNotes() {
|
||||
this.openReleaseNotes(
|
||||
|
||||
Reference in new issue
Block a user