From a1a2eb5b362f837fb6c86f1479f54e4456972390 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:36:29 -0800 Subject: [PATCH] Drop some release sections --- .../release-notes-dialog.component.scss | 7 ++-- .../release-notes-dialog.component.spec.ts | 32 ++++++++++++++++++- .../release-notes-dialog.component.ts | 21 +++++++++++- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.scss b/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.scss index 134bdf9a92..289faa2e94 100644 --- a/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.scss +++ b/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.scss @@ -1,3 +1,6 @@ -:host ::ng-deep .release-notes-body > h2 { - display: none !important; +:host ::ng-deep .release-notes-body > h3 { + font-size: 1rem; + font-weight: 600; + margin-top: 1rem; + margin-bottom: 0.5rem; } diff --git a/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.spec.ts b/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.spec.ts index 82dbab34cc..93935f3554 100644 --- a/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.spec.ts +++ b/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.spec.ts @@ -8,7 +8,10 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { SETTINGS_KEYS } from 'src/app/data/ui-settings' import { SettingsService } from 'src/app/services/settings.service' import { environment } from 'src/environments/environment' -import { ReleaseNotesDialogComponent } from './release-notes-dialog.component' +import { + cleanReleaseBody, + ReleaseNotesDialogComponent, +} from './release-notes-dialog.component' describe('ReleaseNotesDialogComponent', () => { let component: ReleaseNotesDialogComponent @@ -70,6 +73,33 @@ describe('ReleaseNotesDialogComponent', () => { expect(text).not.toContain('(github.com)') }) + it('should drop the duplicate All App Changes section and details markup', () => { + const body = [ + '## paperless-ngx 3.5.1', + '### Bug Fixes', + '- Fix: a thing', + '### Dependencies', + '
', + '1 change', + '', + '- Chore(deps): bump a thing', + '
', + '### All App Changes', + '
', + '2 changes', + '', + '- Fix: a thing', + '- Chore(deps): bump a thing', + '
', + ].join('\r\n') + const cleaned = cleanReleaseBody(body) + expect(cleaned).toContain('### Dependencies') + expect(cleaned).toContain('- Chore(deps): bump a thing') + expect(cleaned).not.toContain('All App Changes') + expect(cleaned).not.toContain('details>') + expect(cleaned).not.toContain('summary>') + }) + it('should show a message if release notes could not be loaded', () => { create(true) component.load(null) diff --git a/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.ts b/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.ts index 3673bee237..66644700b5 100644 --- a/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.ts +++ b/src-ui/src/app/components/common/release-notes-dialog/release-notes-dialog.component.ts @@ -12,6 +12,20 @@ import { SettingsService } from 'src/app/services/settings.service' const RELEASES_URL = 'https://github.com/paperless-ngx/paperless-ngx/releases' +const RELEASE_TITLE = /^\s*##\s+paperless-ngx[^\n]*\n+/i +const ALL_CHANGES_SECTION = /^###\s+All App Changes\s*$[\s\S]*/im +const DETAILS_MARKUP = /^\s*(<\/?details>|.*<\/summary>)\s*$/gim + +/** + * Drops the "## paperless-ngx x.y.z" title, the "All App Changes" + * section and `
` / `` wrappers. + */ +export function cleanReleaseBody(body: string): string { + body = body.replace(RELEASE_TITLE, '') + body = body.replace(ALL_CHANGES_SECTION, '') + return body.replace(DETAILS_MARKUP, '').trim() +} + @Component({ selector: 'pngx-release-notes-dialog', templateUrl: './release-notes-dialog.component.html', @@ -49,7 +63,12 @@ export class ReleaseNotesDialogComponent { .pipe(first()) .subscribe({ next: (notes) => { - this.releases.set(notes.releases) + this.releases.set( + notes.releases.map((release) => ({ + ...release, + body: cleanReleaseBody(release.body), + })) + ) this.loading.set(false) }, error: () => {