From d21385b4556f72dfc1372167f567d75542725d19 Mon Sep 17 00:00:00 2001 From: Nathan Buckingham Date: Wed, 27 May 2026 13:02:57 -0400 Subject: [PATCH 01/79] 141151: Adjust cc license section to expect i18n tags, cc license dropdown menu increase in size --- ...mission-section-cc-licenses.component.html | 34 ++++++++----------- ...mission-section-cc-licenses.component.scss | 7 ++-- src/assets/i18n/en.json5 | 24 +++++++++++++ 3 files changed, 44 insertions(+), 21 deletions(-) diff --git a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html index 93251f5a2d1..490a4f5f8cc 100644 --- a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html +++ b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html @@ -37,11 +37,10 @@ @if (getSelectedCcLicense()) { @for (field of getSelectedCcLicense().fields; track field) { -
+
- {{ field.label }} + {{ field.label | translate }}
@@ -104,14 +102,13 @@
} @if (field.enums?.length <= 5) { @for (option of field.enums; track option) { -
+
- {{ option.label }} + {{ option.label | translate }}
} @@ -123,8 +120,7 @@
@if (ccLicenseLink$) { @let licenseLink = (ccLicenseLink$ | async); @if (licenseLink) { -
+
{{ 'submission.sections.ccLicense.link' | translate }}
@@ -144,4 +140,4 @@
} @else { } -} +} \ No newline at end of file diff --git a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.scss b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.scss index 142cd82822a..108c5b78595 100644 --- a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.scss +++ b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.scss @@ -3,8 +3,11 @@ } .ccLicense-select { - width: fit-content; -} + width: 400px; + ngb-dropdown, .input-group, input.form-control { + width: 100%; + } + } .scrollable-menu { height: auto; diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 727a755a6db..cf7f7af6e46 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -7889,4 +7889,28 @@ "bitstream.related.isReplacedBy": "Is replaced by", "bitstream.related.deleted": "deleted", + + "cc-license.commercial.label": "Allow modifications of your work?", + "cc-license.commercial.hint": "Choose whether others may use your work for commercial purposes.", + + "cc-license.commercial.option.yes.label": "Yes", + "cc-license.commercial.option.yes.hint": "Visitors may copy, distribute, display and perform your Submission for any purpose, including commercial purposes.", + + "cc-license.commercial.option.no.label": "No", + "cc-license.commercial.option.no.hint": "Visitors may copy, distribute, display and perform your Submission, but only for non-commercial purposes.", + + "cc-license.derivatives.label": "Allow modifications of your work?", + "cc-license.derivatives.hint": "Choose whether others may create derivative works based on your Submission.", + + "cc-license.derivatives.option.yes.label": "Yes", + "cc-license.derivatives.option.yes.hint": "Visitors may copy, distribute, display, perform and modify your Submission in any way.", + + "cc-license.derivatives.option.sharealike.label": "ShareAlike", + "cc-license.derivatives.option.sharealike.hint": "Visitors are permitted to copy, display, perform and modify your Submission, as long as they distribute the modified version on similar use terms.", + + "cc-license.derivatives.option.no.label": "No", + "cc-license.derivatives.option.no.hint": "Visitors are only permitted to copy and distribute unaltered versions of your Submission.", + + "cc-license.jurisdiction.label": "Jurisdiction", + "cc-license.jurisdiction.hint": "Select the legal jurisdiction for your Creative Commons license, or leave as the default international license.", } From 9cb0818594604eca8121c708e86b2dafc8f6ac73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan=C3=A1sz-Nagy=20Zolt=C3=A1n?= Date: Wed, 13 May 2026 09:03:05 +0200 Subject: [PATCH 02/79] QREPO-405 extending translate loader to use theme inheritence --- .../translate-browser.loader.ts | 95 ++++++++++++-- .../translate-server.loader.ts | 116 ++++++++++++++++-- 2 files changed, 192 insertions(+), 19 deletions(-) diff --git a/src/ngx-translate-loaders/translate-browser.loader.ts b/src/ngx-translate-loaders/translate-browser.loader.ts index 44e1710b148..caf8f255a69 100644 --- a/src/ngx-translate-loaders/translate-browser.loader.ts +++ b/src/ngx-translate-loaders/translate-browser.loader.ts @@ -2,11 +2,16 @@ import { HttpClient } from '@angular/common/http'; import { TransferState } from '@angular/core'; import { hasValue } from '@dspace/shared/utils/empty.util'; import { TranslateLoader } from '@ngx-translate/core'; +import * as JSON5 from 'json5'; import { + forkJoin, Observable, of, } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { + catchError, + map, +} from 'rxjs/operators'; import { environment } from '../environments/environment'; import { @@ -16,7 +21,12 @@ import { /** * A TranslateLoader for ngx-translate to retrieve i18n messages from the TransferState, or download - * them if they're not available there + * them if they're not available there. + * + * Also fetches per-theme translation overrides from `assets//i18n/.json5` for every + * configured theme and deep-merges them on top of the base translations (theme keys win). + * This removes the need for the build-time `merge-i18n` script, allowing a single Docker image + * to serve multiple customers with their own theme-specific translations. */ export class TranslateBrowserLoader implements TranslateLoader { constructor( @@ -35,18 +45,83 @@ export class TranslateBrowserLoader implements TranslateLoader { */ getTranslation(lang: string): Observable { // Get the ngx-translate messages from the transfer state, to speed up the initial page load - // client side + // client side. The server has already merged theme overrides into this state. const state = this.transferState.get(NGX_TRANSLATE_STATE, {}); const messages = state[lang]; if (hasValue(messages)) { return of(messages); - } else { - const translationHash: string = environment.production ? `.${(process.env.languageHashes as any)[lang + '.json5']}` : ''; - // If they're not available on the transfer state (e.g. when running in dev mode), retrieve - // them using HttpClient - return this.http.get(`${this.prefix}${lang}${translationHash}${this.suffix}`, { responseType: 'text' }).pipe( - map((json: any) => JSON.parse(json)), - ); } + + // Fetch base translations + every configured theme's override file (in inheritance order) + // and merge them. Theme keys override base keys; child theme keys override parent theme keys. + const base$ = this.fetchBase(lang); + const orderedThemes = this.resolveThemeLoadOrder(environment.themes as any || []); + const themeStreams = orderedThemes.map((name: string) => this.fetchThemeOverride(name, lang)); + + return forkJoin([base$, ...themeStreams]).pipe( + map((parts) => parts.reduce((acc, part) => Object.assign(acc, part), {})), + ); + } + + /** + * Resolve the load order for the configured themes, expanding `extends` chains so that + * ancestor themes are loaded before their descendants (descendant wins on conflicts). + * See {@link TranslateServerLoader.resolveThemeLoadOrder} for details. + */ + protected resolveThemeLoadOrder(configured: Array<{ name?: string; extends?: string }>): string[] { + const byName = new Map(); + configured.forEach((t) => { + if (t?.name) { + byName.set(t.name, t); + } + }); + + const result: string[] = []; + const seen = new Set(); + + for (const theme of configured) { + if (!theme?.name) { + continue; + } + const chain: string[] = []; + const visited = new Set(); + let cursor: string | undefined = theme.name; + while (cursor && !visited.has(cursor)) { + visited.add(cursor); + chain.push(cursor); + cursor = byName.get(cursor)?.extends; + } + for (const name of chain.reverse()) { + if (!seen.has(name)) { + seen.add(name); + result.push(name); + } + } + } + return result; + } + + /** + * Fetch the base i18n file (the hashed JSON produced by the build pipeline). + */ + protected fetchBase(lang: string): Observable> { + const translationHash: string = environment.production + ? `.${(process.env.languageHashes as any)[lang + '.json5']}` + : ''; + return this.http.get(`${this.prefix}${lang}${translationHash}${this.suffix}`, { responseType: 'text' }).pipe( + map((json: any) => JSON.parse(json)), + catchError(() => of({})), + ); + } + + /** + * Fetch the override JSON5 file for the given theme/language. + * Returns an empty object if the file is missing (most themes won't override every language). + */ + protected fetchThemeOverride(themeName: string, lang: string): Observable> { + return this.http.get(`assets/${themeName}/i18n/${lang}.json5`, { responseType: 'text' }).pipe( + map((text: string) => JSON5.parse(text) as Record), + catchError(() => of({})), + ); } } diff --git a/src/ngx-translate-loaders/translate-server.loader.ts b/src/ngx-translate-loaders/translate-server.loader.ts index 06312b3a2b0..6e64b618e26 100644 --- a/src/ngx-translate-loaders/translate-server.loader.ts +++ b/src/ngx-translate-loaders/translate-server.loader.ts @@ -1,12 +1,18 @@ -import { readFileSync } from 'node:fs'; +import { + existsSync, + readFileSync, +} from 'node:fs'; +import { dirname, resolve } from 'node:path'; import { TransferState } from '@angular/core'; import { TranslateLoader } from '@ngx-translate/core'; +import * as JSON5 from 'json5'; import { Observable, of, } from 'rxjs'; +import { environment } from '../environments/environment'; import { NGX_TRANSLATE_STATE, NgxTranslateState, @@ -14,7 +20,12 @@ import { /** * A TranslateLoader for ngx-translate to parse json5 files server-side, and store them in the - * TransferState + * TransferState. + * + * Also overlays per-theme translation overrides from `//i18n/.json5` + * for every configured theme, merging them on top of the base translations (theme keys win). + * The resulting merged map is stored in the TransferState so the browser does not need to + * re-fetch the theme overrides after the initial SSR response. */ export class TranslateServerLoader implements TranslateLoader { @@ -32,13 +43,100 @@ export class TranslateServerLoader implements TranslateLoader { */ public getTranslation(lang: string): Observable { const translationHash: string = (process.env.languageHashes as any)[lang + '.json5']; - // Retrieve the file for the given language, and parse it - const messages = JSON.parse(readFileSync(`${this.prefix}${lang}.${translationHash}${this.suffix}`, 'utf8')); - // Store the parsed messages in the transfer state so they'll be available immediately when the - // app loads on the client - this.storeInTransferState(lang, messages); - // Return the parsed messages to translate things server side - return of(messages); + // Retrieve the base file for the given language and parse it + const baseMessages = JSON.parse(readFileSync(`${this.prefix}${lang}.${translationHash}${this.suffix}`, 'utf8')); + + // Overlay theme override files (if any). Theme keys override base keys. + const merged = Object.assign({}, baseMessages, this.readThemeOverrides(lang)); + + // Store the parsed messages in the transfer state so they'll be available immediately when + // the app loads on the client + this.storeInTransferState(lang, merged); + // Return the merged messages to translate things server side + return of(merged); + } + + /** + * Read and merge i18n override files from every configured theme's assets folder. + * Returns an empty object if no overrides are present. + * + * @param lang the language code + * @protected + */ + protected readThemeOverrides(lang: string): Record { + const configured = (environment.themes || []) as Array<{ name?: string; extends?: string }>; + if (configured.length === 0) { + return {}; + } + + // Build the ordered list of themes to load, expanding each configured theme's inheritance + // chain (ancestor first, descendant last) so that child theme overrides win over parents. + const orderedThemes = this.resolveThemeLoadOrder(configured); + + // `this.prefix` looks like `dist/server/assets/i18n/`. Theme assets live next to `i18n/` + // at `dist/server/assets//i18n/.json5`. + const assetsRoot = dirname(this.prefix.replace(/\/$/, '')); + + const overrides: Record = {}; + for (const theme of orderedThemes) { + const filePath = resolve(`${assetsRoot}/${theme}/i18n/${lang}.json5`); + if (existsSync(filePath)) { + try { + const themeMessages = JSON5.parse(readFileSync(filePath, 'utf8')) as Record; + Object.assign(overrides, themeMessages); + } catch (e) { + // Skip malformed theme i18n files so they don't break SSR + // eslint-disable-next-line no-console + console.warn(`[TranslateServerLoader] Failed to parse theme i18n file ${filePath}:`, e); + } + } + } + return overrides; + } + + /** + * Resolve the load order for the given configured themes, expanding `extends` chains. + * + * For each configured theme we walk up its `extends` chain, then emit themes from the root + * ancestor down to the descendant. Duplicates are removed (a theme already loaded as an + * ancestor of an earlier configured theme is not loaded again). + * + * Example given `themes: [kjk (extends qulto)]`: + * load order = [qulto, kjk] → qulto keys, then kjk keys override + */ + protected resolveThemeLoadOrder(configured: Array<{ name?: string; extends?: string }>): string[] { + const byName = new Map(); + configured.forEach((t) => { + if (t?.name) { + byName.set(t.name, t); + } + }); + + const result: string[] = []; + const seen = new Set(); + + for (const theme of configured) { + if (!theme?.name) { + continue; + } + // Build chain from theme up to root ancestor (handle cycles). + const chain: string[] = []; + const visited = new Set(); + let cursor: string | undefined = theme.name; + while (cursor && !visited.has(cursor)) { + visited.add(cursor); + chain.push(cursor); + cursor = byName.get(cursor)?.extends; + } + // Reverse so we apply ancestor → descendant order. + for (const name of chain.reverse()) { + if (!seen.has(name)) { + seen.add(name); + result.push(name); + } + } + } + return result; } /** From 6add72ca3adf7f3cfd3d095aa9915c9a51324c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan=C3=A1sz-Nagy=20Zolt=C3=A1n?= Date: Wed, 13 May 2026 09:36:57 +0200 Subject: [PATCH 03/79] QREPO-405 fixing problems reported by lint --- src/ngx-translate-loaders/translate-browser.loader.ts | 2 +- src/ngx-translate-loaders/translate-server.loader.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ngx-translate-loaders/translate-browser.loader.ts b/src/ngx-translate-loaders/translate-browser.loader.ts index caf8f255a69..bb973576441 100644 --- a/src/ngx-translate-loaders/translate-browser.loader.ts +++ b/src/ngx-translate-loaders/translate-browser.loader.ts @@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http'; import { TransferState } from '@angular/core'; import { hasValue } from '@dspace/shared/utils/empty.util'; import { TranslateLoader } from '@ngx-translate/core'; -import * as JSON5 from 'json5'; +import JSON5 from 'json5'; import { forkJoin, Observable, diff --git a/src/ngx-translate-loaders/translate-server.loader.ts b/src/ngx-translate-loaders/translate-server.loader.ts index 6e64b618e26..8b15b0db300 100644 --- a/src/ngx-translate-loaders/translate-server.loader.ts +++ b/src/ngx-translate-loaders/translate-server.loader.ts @@ -2,11 +2,14 @@ import { existsSync, readFileSync, } from 'node:fs'; -import { dirname, resolve } from 'node:path'; +import { + dirname, + resolve, +} from 'node:path'; import { TransferState } from '@angular/core'; import { TranslateLoader } from '@ngx-translate/core'; -import * as JSON5 from 'json5'; +import JSON5 from 'json5'; import { Observable, of, From 286bb5b0c49ff104904a88a1bea10fdb106ea034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan=C3=A1sz-Nagy=20Zolt=C3=A1n?= Date: Wed, 3 Jun 2026 15:07:36 +0200 Subject: [PATCH 04/79] QREPO-405 moving resolveThemeLoadOrder into a separate util and making tests --- .../theme-i18n.util.spec.ts | 57 +++++++++ src/ngx-translate-loaders/theme-i18n.util.ts | 54 ++++++++ .../translate-browser.loader.spec.ts | 118 ++++++++++++++++++ .../translate-browser.loader.ts | 41 +----- .../translate-server.loader.ts | 50 +------- 5 files changed, 234 insertions(+), 86 deletions(-) create mode 100644 src/ngx-translate-loaders/theme-i18n.util.spec.ts create mode 100644 src/ngx-translate-loaders/theme-i18n.util.ts create mode 100644 src/ngx-translate-loaders/translate-browser.loader.spec.ts diff --git a/src/ngx-translate-loaders/theme-i18n.util.spec.ts b/src/ngx-translate-loaders/theme-i18n.util.spec.ts new file mode 100644 index 00000000000..64034b660d0 --- /dev/null +++ b/src/ngx-translate-loaders/theme-i18n.util.spec.ts @@ -0,0 +1,57 @@ +import { NamedThemeConfig } from '@dspace/config/theme.config'; + +import { resolveThemeLoadOrder } from './theme-i18n.util'; + +describe('resolveThemeLoadOrder', () => { + const theme = (name: string, ext?: string): NamedThemeConfig => + ext ? { name, extends: ext } : { name }; + + it('returns an empty array when no themes are configured', () => { + expect(resolveThemeLoadOrder([])).toEqual([]); + }); + + it('keeps configuration order for themes without an extends chain', () => { + expect(resolveThemeLoadOrder([theme('first-theme'), theme('second-theme')])) + .toEqual(['first-theme', 'second-theme']); + }); + + it('emits ancestor before descendant for an extends chain', () => { + expect(resolveThemeLoadOrder([theme('child-theme', 'parent-theme'), theme('parent-theme')])) + .toEqual(['parent-theme', 'child-theme']); + }); + + it('emits ancestor before descendant regardless of configuration order', () => { + expect(resolveThemeLoadOrder([theme('parent-theme'), theme('child-theme', 'parent-theme')])) + .toEqual(['parent-theme', 'child-theme']); + }); + + it('expands a multi-level extends chain (root → leaf)', () => { + expect(resolveThemeLoadOrder([ + theme('child-theme', 'parent-theme'), + theme('parent-theme', 'base-theme'), + theme('base-theme'), + ])).toEqual(['base-theme', 'parent-theme', 'child-theme']); + }); + + it('includes an ancestor referenced via extends even when it is not separately configured', () => { + expect(resolveThemeLoadOrder([theme('child-theme', 'parent-theme')])) + .toEqual(['parent-theme', 'child-theme']); + }); + + it('de-duplicates a shared ancestor of multiple themes', () => { + expect(resolveThemeLoadOrder([ + theme('child-theme', 'parent-theme'), + theme('sibling-theme', 'parent-theme'), + ])).toEqual(['parent-theme', 'child-theme', 'sibling-theme']); + }); + + it('terminates and emits each theme once when extends forms a cycle', () => { + const order = resolveThemeLoadOrder([theme('theme-a', 'theme-b'), theme('theme-b', 'theme-a')]); + expect(order.length).toBe(2); + expect([...order].sort()).toEqual(['theme-a', 'theme-b']); + }); + + it('ignores entries without a (truthy) name', () => { + expect(resolveThemeLoadOrder([theme(''), theme('first-theme')])).toEqual(['first-theme']); + }); +}); diff --git a/src/ngx-translate-loaders/theme-i18n.util.ts b/src/ngx-translate-loaders/theme-i18n.util.ts new file mode 100644 index 00000000000..11707e2cb5a --- /dev/null +++ b/src/ngx-translate-loaders/theme-i18n.util.ts @@ -0,0 +1,54 @@ +import { ThemeConfig } from '@dspace/config/theme.config'; + +/** + * Resolve the load order for the given configured themes, expanding their `extends` chains. + * + * For each configured theme we walk up its `extends` chain and then emit the themes from the root + * ancestor down to the descendant. Duplicates are removed (a theme already emitted as an ancestor + * of an earlier configured theme is not emitted again), and `extends` cycles are handled gracefully + * (each theme is visited at most once while building a single chain). + * + * Applying i18n override files in the resulting order makes descendant theme keys win over their + * ancestors, and later-configured themes win over earlier ones. + * + * Example given `themes: [child-theme (extends base-theme)]`: + * load order = [base-theme, child-theme] → base-theme keys first, then child-theme keys override + * + * @param configured the configured themes (typically `environment.themes`) + * @returns the ordered, de-duplicated list of theme names to load (ancestor → descendant) + */ +export function resolveThemeLoadOrder(configured: ThemeConfig[]): string[] { + const byName = new Map(); + configured.forEach((theme) => { + if (theme?.name) { + byName.set(theme.name, theme); + } + }); + + const result: string[] = []; + const seen = new Set(); + + for (const theme of configured) { + if (!theme?.name) { + continue; + } + // Build the chain from this theme up to its root ancestor (guarding against `extends` cycles). + const chain: string[] = []; + const visited = new Set(); + let cursor: string | undefined = theme.name; + while (cursor && !visited.has(cursor)) { + visited.add(cursor); + chain.push(cursor); + cursor = byName.get(cursor)?.extends; + } + // Reverse so we emit ancestor → descendant order. + for (const name of chain.reverse()) { + if (!seen.has(name)) { + seen.add(name); + result.push(name); + } + } + } + + return result; +} diff --git a/src/ngx-translate-loaders/translate-browser.loader.spec.ts b/src/ngx-translate-loaders/translate-browser.loader.spec.ts new file mode 100644 index 00000000000..68ebe7a2e0a --- /dev/null +++ b/src/ngx-translate-loaders/translate-browser.loader.spec.ts @@ -0,0 +1,118 @@ +import { + of, + throwError, +} from 'rxjs'; + +import { environment } from '../environments/environment'; +import { TranslateBrowserLoader } from './translate-browser.loader'; + +describe('TranslateBrowserLoader', () => { + const PREFIX = 'assets/i18n/'; + const SUFFIX = '.json'; + + let transferState: { get: jasmine.Spy; set: jasmine.Spy }; + let http: { get: jasmine.Spy }; + let loader: TranslateBrowserLoader; + let originalThemes: typeof environment.themes; + + /** Match the base i18n request regardless of the production content hash. */ + const isBaseRequest = (url: string): boolean => url.startsWith(`${PREFIX}en`) && url.endsWith(SUFFIX); + + beforeEach(() => { + transferState = { + get: jasmine.createSpy('get'), + set: jasmine.createSpy('set'), + }; + http = { get: jasmine.createSpy('get') }; + loader = new TranslateBrowserLoader(transferState as any, http as any, PREFIX, SUFFIX); + originalThemes = environment.themes; + }); + + afterEach(() => { + environment.themes = originalThemes; + }); + + it('returns the cached translations from the TransferState without any HTTP call', (done) => { + const cached = { 'home.title': 'Cached' }; + transferState.get.and.returnValue({ en: cached }); + + loader.getTranslation('en').subscribe((messages) => { + expect(messages).toEqual(cached); + expect(http.get).not.toHaveBeenCalled(); + done(); + }); + }); + + it('fetches the base file and merges theme overrides on top (theme keys win)', (done) => { + environment.themes = [{ name: 'custom' }]; + transferState.get.and.returnValue({}); + http.get.and.callFake((url: string) => { + if (isBaseRequest(url)) { + return of(JSON.stringify({ 'home.title': 'Base', 'home.subtitle': 'Base sub' })); + } + if (url === 'assets/custom/i18n/en.json5') { + return of('{ "home.title": "Custom" }'); + } + return throwError(() => new Error('404')); + }); + + loader.getTranslation('en').subscribe((messages) => { + expect(messages).toEqual({ 'home.title': 'Custom', 'home.subtitle': 'Base sub' }); + done(); + }); + }); + + it('falls back to the base translations when a theme override file is missing', (done) => { + environment.themes = [{ name: 'custom' }]; + transferState.get.and.returnValue({}); + http.get.and.callFake((url: string) => { + if (isBaseRequest(url)) { + return of(JSON.stringify({ 'home.title': 'Base' })); + } + return throwError(() => new Error('404')); + }); + + loader.getTranslation('en').subscribe((messages) => { + expect(messages).toEqual({ 'home.title': 'Base' }); + done(); + }); + }); + + it('applies overrides in inheritance order so descendant themes win over ancestors', (done) => { + environment.themes = [{ name: 'child-theme', extends: 'parent-theme' }, { name: 'parent-theme' }]; + transferState.get.and.returnValue({}); + http.get.and.callFake((url: string) => { + if (isBaseRequest(url)) { + return of(JSON.stringify({ key: 'base' })); + } + if (url === 'assets/parent-theme/i18n/en.json5') { + return of('{ key: "parent" }'); + } + if (url === 'assets/child-theme/i18n/en.json5') { + return of('{ key: "child" }'); + } + return throwError(() => new Error('404')); + }); + + loader.getTranslation('en').subscribe((messages) => { + expect(messages.key).toBe('child'); + done(); + }); + }); + + it('returns the base translations unchanged when no themes are configured', (done) => { + environment.themes = []; + transferState.get.and.returnValue({}); + http.get.and.callFake((url: string) => { + if (isBaseRequest(url)) { + return of(JSON.stringify({ 'home.title': 'Base' })); + } + return throwError(() => new Error('404')); + }); + + loader.getTranslation('en').subscribe((messages) => { + expect(messages).toEqual({ 'home.title': 'Base' }); + done(); + }); + }); +}); diff --git a/src/ngx-translate-loaders/translate-browser.loader.ts b/src/ngx-translate-loaders/translate-browser.loader.ts index bb973576441..93d20426591 100644 --- a/src/ngx-translate-loaders/translate-browser.loader.ts +++ b/src/ngx-translate-loaders/translate-browser.loader.ts @@ -18,6 +18,7 @@ import { NGX_TRANSLATE_STATE, NgxTranslateState, } from './ngx-translate-state'; +import { resolveThemeLoadOrder } from './theme-i18n.util'; /** * A TranslateLoader for ngx-translate to retrieve i18n messages from the TransferState, or download @@ -55,7 +56,7 @@ export class TranslateBrowserLoader implements TranslateLoader { // Fetch base translations + every configured theme's override file (in inheritance order) // and merge them. Theme keys override base keys; child theme keys override parent theme keys. const base$ = this.fetchBase(lang); - const orderedThemes = this.resolveThemeLoadOrder(environment.themes as any || []); + const orderedThemes = resolveThemeLoadOrder(environment.themes ?? []); const themeStreams = orderedThemes.map((name: string) => this.fetchThemeOverride(name, lang)); return forkJoin([base$, ...themeStreams]).pipe( @@ -63,44 +64,6 @@ export class TranslateBrowserLoader implements TranslateLoader { ); } - /** - * Resolve the load order for the configured themes, expanding `extends` chains so that - * ancestor themes are loaded before their descendants (descendant wins on conflicts). - * See {@link TranslateServerLoader.resolveThemeLoadOrder} for details. - */ - protected resolveThemeLoadOrder(configured: Array<{ name?: string; extends?: string }>): string[] { - const byName = new Map(); - configured.forEach((t) => { - if (t?.name) { - byName.set(t.name, t); - } - }); - - const result: string[] = []; - const seen = new Set(); - - for (const theme of configured) { - if (!theme?.name) { - continue; - } - const chain: string[] = []; - const visited = new Set(); - let cursor: string | undefined = theme.name; - while (cursor && !visited.has(cursor)) { - visited.add(cursor); - chain.push(cursor); - cursor = byName.get(cursor)?.extends; - } - for (const name of chain.reverse()) { - if (!seen.has(name)) { - seen.add(name); - result.push(name); - } - } - } - return result; - } - /** * Fetch the base i18n file (the hashed JSON produced by the build pipeline). */ diff --git a/src/ngx-translate-loaders/translate-server.loader.ts b/src/ngx-translate-loaders/translate-server.loader.ts index 8b15b0db300..2c16a18dbad 100644 --- a/src/ngx-translate-loaders/translate-server.loader.ts +++ b/src/ngx-translate-loaders/translate-server.loader.ts @@ -20,6 +20,7 @@ import { NGX_TRANSLATE_STATE, NgxTranslateState, } from './ngx-translate-state'; +import { resolveThemeLoadOrder } from './theme-i18n.util'; /** * A TranslateLoader for ngx-translate to parse json5 files server-side, and store them in the @@ -67,14 +68,14 @@ export class TranslateServerLoader implements TranslateLoader { * @protected */ protected readThemeOverrides(lang: string): Record { - const configured = (environment.themes || []) as Array<{ name?: string; extends?: string }>; + const configured = environment.themes ?? []; if (configured.length === 0) { return {}; } // Build the ordered list of themes to load, expanding each configured theme's inheritance // chain (ancestor first, descendant last) so that child theme overrides win over parents. - const orderedThemes = this.resolveThemeLoadOrder(configured); + const orderedThemes = resolveThemeLoadOrder(configured); // `this.prefix` looks like `dist/server/assets/i18n/`. Theme assets live next to `i18n/` // at `dist/server/assets//i18n/.json5`. @@ -97,51 +98,6 @@ export class TranslateServerLoader implements TranslateLoader { return overrides; } - /** - * Resolve the load order for the given configured themes, expanding `extends` chains. - * - * For each configured theme we walk up its `extends` chain, then emit themes from the root - * ancestor down to the descendant. Duplicates are removed (a theme already loaded as an - * ancestor of an earlier configured theme is not loaded again). - * - * Example given `themes: [kjk (extends qulto)]`: - * load order = [qulto, kjk] → qulto keys, then kjk keys override - */ - protected resolveThemeLoadOrder(configured: Array<{ name?: string; extends?: string }>): string[] { - const byName = new Map(); - configured.forEach((t) => { - if (t?.name) { - byName.set(t.name, t); - } - }); - - const result: string[] = []; - const seen = new Set(); - - for (const theme of configured) { - if (!theme?.name) { - continue; - } - // Build chain from theme up to root ancestor (handle cycles). - const chain: string[] = []; - const visited = new Set(); - let cursor: string | undefined = theme.name; - while (cursor && !visited.has(cursor)) { - visited.add(cursor); - chain.push(cursor); - cursor = byName.get(cursor)?.extends; - } - // Reverse so we apply ancestor → descendant order. - for (const name of chain.reverse()) { - if (!seen.has(name)) { - seen.add(name); - result.push(name); - } - } - } - return result; - } - /** * Store the i18n messages for the given language code in the transfer state, so they can be * retrieved client side From 8143bf211b062dd9e36e0c46c752fd4c62f0b831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan=C3=A1sz-Nagy=20Zolt=C3=A1n?= Date: Thu, 4 Jun 2026 21:25:07 +0200 Subject: [PATCH 05/79] QREPO-405 using active theme chain for determining theme order --- .../theme-i18n.util.spec.ts | 73 +++++++++++-------- src/ngx-translate-loaders/theme-i18n.util.ts | 68 ++++++++--------- .../translate-browser.loader.spec.ts | 56 ++++++++++++++ .../translate-browser.loader.ts | 17 +++-- .../translate-server.loader.ts | 16 ++-- 5 files changed, 148 insertions(+), 82 deletions(-) diff --git a/src/ngx-translate-loaders/theme-i18n.util.spec.ts b/src/ngx-translate-loaders/theme-i18n.util.spec.ts index 64034b660d0..5d17d0c9adc 100644 --- a/src/ngx-translate-loaders/theme-i18n.util.spec.ts +++ b/src/ngx-translate-loaders/theme-i18n.util.spec.ts @@ -1,57 +1,68 @@ import { NamedThemeConfig } from '@dspace/config/theme.config'; -import { resolveThemeLoadOrder } from './theme-i18n.util'; +import { resolveActiveThemeChain } from './theme-i18n.util'; -describe('resolveThemeLoadOrder', () => { +describe('resolveActiveThemeChain', () => { const theme = (name: string, ext?: string): NamedThemeConfig => ext ? { name, extends: ext } : { name }; - it('returns an empty array when no themes are configured', () => { - expect(resolveThemeLoadOrder([])).toEqual([]); + it('returns an empty array when activeName is empty', () => { + expect(resolveActiveThemeChain([theme('custom')], '')).toEqual([]); }); - it('keeps configuration order for themes without an extends chain', () => { - expect(resolveThemeLoadOrder([theme('first-theme'), theme('second-theme')])) - .toEqual(['first-theme', 'second-theme']); + it('returns [active] when the active theme has no extends', () => { + expect(resolveActiveThemeChain([theme('custom')], 'custom')).toEqual(['custom']); }); - it('emits ancestor before descendant for an extends chain', () => { - expect(resolveThemeLoadOrder([theme('child-theme', 'parent-theme'), theme('parent-theme')])) - .toEqual(['parent-theme', 'child-theme']); + it('returns [parent, active] when active extends a configured parent', () => { + expect(resolveActiveThemeChain( + [theme('custom'), theme('child-theme', 'custom')], + 'child-theme', + )).toEqual(['custom', 'child-theme']); }); - it('emits ancestor before descendant regardless of configuration order', () => { - expect(resolveThemeLoadOrder([theme('parent-theme'), theme('child-theme', 'parent-theme')])) - .toEqual(['parent-theme', 'child-theme']); + it('resolves the chain even when the active theme is listed before its parent', () => { + expect(resolveActiveThemeChain( + [theme('child-theme', 'parent-theme'), theme('parent-theme')], + 'child-theme', + )).toEqual(['parent-theme', 'child-theme']); }); - it('expands a multi-level extends chain (root → leaf)', () => { - expect(resolveThemeLoadOrder([ - theme('child-theme', 'parent-theme'), - theme('parent-theme', 'base-theme'), - theme('base-theme'), - ])).toEqual(['base-theme', 'parent-theme', 'child-theme']); + it('expands a multi-level chain (root → mid → active)', () => { + expect(resolveActiveThemeChain( + [theme('child-theme', 'parent-theme'), theme('parent-theme', 'base-theme'), theme('base-theme')], + 'child-theme', + )).toEqual(['base-theme', 'parent-theme', 'child-theme']); }); - it('includes an ancestor referenced via extends even when it is not separately configured', () => { - expect(resolveThemeLoadOrder([theme('child-theme', 'parent-theme')])) - .toEqual(['parent-theme', 'child-theme']); + it('includes an ancestor even when it is not separately listed in configured themes', () => { + expect(resolveActiveThemeChain( + [theme('child-theme', 'parent-theme')], + 'child-theme', + )).toEqual(['parent-theme', 'child-theme']); }); - it('de-duplicates a shared ancestor of multiple themes', () => { - expect(resolveThemeLoadOrder([ - theme('child-theme', 'parent-theme'), - theme('sibling-theme', 'parent-theme'), - ])).toEqual(['parent-theme', 'child-theme', 'sibling-theme']); + it('does NOT include sibling themes — only the active chain', () => { + // sibling-theme and child-theme both extend parent-theme; when child-theme is active, + // sibling-theme must not appear in the chain. + const chain = resolveActiveThemeChain( + [theme('parent-theme'), theme('child-theme', 'parent-theme'), theme('sibling-theme', 'parent-theme')], + 'child-theme', + ); + expect(chain).toEqual(['parent-theme', 'child-theme']); + expect(chain).not.toContain('sibling-theme'); }); - it('terminates and emits each theme once when extends forms a cycle', () => { - const order = resolveThemeLoadOrder([theme('theme-a', 'theme-b'), theme('theme-b', 'theme-a')]); + it('terminates and includes each theme once when extends forms a cycle', () => { + const order = resolveActiveThemeChain( + [theme('theme-a', 'theme-b'), theme('theme-b', 'theme-a')], + 'theme-a', + ); expect(order.length).toBe(2); expect([...order].sort()).toEqual(['theme-a', 'theme-b']); }); - it('ignores entries without a (truthy) name', () => { - expect(resolveThemeLoadOrder([theme(''), theme('first-theme')])).toEqual(['first-theme']); + it('returns [active] when activeName does not match any configured theme', () => { + expect(resolveActiveThemeChain([theme('custom')], 'unknown-theme')).toEqual(['unknown-theme']); }); }); diff --git a/src/ngx-translate-loaders/theme-i18n.util.ts b/src/ngx-translate-loaders/theme-i18n.util.ts index 11707e2cb5a..6f860025660 100644 --- a/src/ngx-translate-loaders/theme-i18n.util.ts +++ b/src/ngx-translate-loaders/theme-i18n.util.ts @@ -1,54 +1,44 @@ import { ThemeConfig } from '@dspace/config/theme.config'; /** - * Resolve the load order for the given configured themes, expanding their `extends` chains. + * Resolve the i18n load order for a single **active** theme, walking up its + * `extends` chain so ancestors are loaded before descendants (ancestor keys + * are overridden by descendant keys). * - * For each configured theme we walk up its `extends` chain and then emit the themes from the root - * ancestor down to the descendant. Duplicates are removed (a theme already emitted as an ancestor - * of an earlier configured theme is not emitted again), and `extends` cycles are handled gracefully - * (each theme is visited at most once while building a single chain). + * Only the active theme's inheritance chain is returned. Sibling themes that + * are configured but not active are intentionally excluded — loading all + * configured themes caused cross-theme key pollution (a sibling theme's + * translations silently overriding the active theme's keys). * - * Applying i18n override files in the resulting order makes descendant theme keys win over their - * ancestors, and later-configured themes win over earlier ones. + * This mirrors the official `merge-i18n` CLI approach, which merges exactly + * one theme at a time: `npm run merge-i18n -- -s src/themes//assets/i18n`. * - * Example given `themes: [child-theme (extends base-theme)]`: - * load order = [base-theme, child-theme] → base-theme keys first, then child-theme keys override + * `extends` cycles are handled gracefully (each theme name appears at most once). + * + * Examples (config `[base-theme, child-theme (extends base-theme), sibling-theme (extends base-theme)]`): + * active = 'base-theme' (no extends) → ['base-theme'] + * active = 'child-theme' (extends: 'base-theme') → ['base-theme', 'child-theme'] + * active = 'sibling-theme' (extends: 'base-theme') → ['base-theme', 'sibling-theme'] * * @param configured the configured themes (typically `environment.themes`) - * @returns the ordered, de-duplicated list of theme names to load (ancestor → descendant) + * @param activeName the name of the active/default theme + * @returns ordered list of theme names to load (root ancestor → active theme) */ -export function resolveThemeLoadOrder(configured: ThemeConfig[]): string[] { +export function resolveActiveThemeChain(configured: ThemeConfig[], activeName: string): string[] { const byName = new Map(); - configured.forEach((theme) => { - if (theme?.name) { - byName.set(theme.name, theme); + configured.forEach((t) => { + if (t?.name) { + byName.set(t.name, t); } }); - const result: string[] = []; - const seen = new Set(); - - for (const theme of configured) { - if (!theme?.name) { - continue; - } - // Build the chain from this theme up to its root ancestor (guarding against `extends` cycles). - const chain: string[] = []; - const visited = new Set(); - let cursor: string | undefined = theme.name; - while (cursor && !visited.has(cursor)) { - visited.add(cursor); - chain.push(cursor); - cursor = byName.get(cursor)?.extends; - } - // Reverse so we emit ancestor → descendant order. - for (const name of chain.reverse()) { - if (!seen.has(name)) { - seen.add(name); - result.push(name); - } - } + const chain: string[] = []; + const visited = new Set(); + let cursor: string | undefined = activeName; + while (cursor && !visited.has(cursor)) { + visited.add(cursor); + chain.push(cursor); + cursor = byName.get(cursor)?.extends; } - - return result; + return chain.reverse(); // ancestor → descendant } diff --git a/src/ngx-translate-loaders/translate-browser.loader.spec.ts b/src/ngx-translate-loaders/translate-browser.loader.spec.ts index 68ebe7a2e0a..02e5e42d625 100644 --- a/src/ngx-translate-loaders/translate-browser.loader.spec.ts +++ b/src/ngx-translate-loaders/translate-browser.loader.spec.ts @@ -115,4 +115,60 @@ describe('TranslateBrowserLoader', () => { done(); }); }); + + it('does NOT apply sibling theme overrides when the active theme is first in the list', (done) => { + // Regression: when parent-theme is active, a sibling theme that also extends parent-theme + // must NOT override parent-theme's translations. + environment.themes = [ + { name: 'parent-theme' }, + { name: 'sibling-theme', extends: 'parent-theme' }, + ]; + transferState.get.and.returnValue({}); + http.get.and.callFake((url: string) => { + if (isBaseRequest(url)) { + return of(JSON.stringify({ key: 'base' })); + } + if (url === 'assets/parent-theme/i18n/en.json5') { + return of('{ key: "parent" }'); + } + if (url === 'assets/sibling-theme/i18n/en.json5') { + // sibling has its own value for the same key — must NOT win when parent-theme is active + return of('{ key: "sibling" }'); + } + return throwError(() => new Error('404')); + }); + + loader.getTranslation('en').subscribe((messages) => { + expect(messages.key).toBe('parent'); + done(); + }); + }); + + it('applies the full ancestor chain when a child theme is active', (done) => { + // When child-theme (extends parent-theme) is active, parent-theme keys provide the base + // and child-theme keys override only what they define. + environment.themes = [ + { name: 'child-theme', extends: 'parent-theme' }, + { name: 'parent-theme' }, + ]; + transferState.get.and.returnValue({}); + http.get.and.callFake((url: string) => { + if (isBaseRequest(url)) { + return of(JSON.stringify({ 'key.a': 'base-a', 'key.b': 'base-b' })); + } + if (url === 'assets/parent-theme/i18n/en.json5') { + return of('{ "key.a": "parent-a" }'); + } + if (url === 'assets/child-theme/i18n/en.json5') { + return of('{ "key.b": "child-b" }'); + } + return throwError(() => new Error('404')); + }); + + loader.getTranslation('en').subscribe((messages) => { + expect(messages['key.a']).toBe('parent-a'); // inherited from parent-theme + expect(messages['key.b']).toBe('child-b'); // overridden by child-theme + done(); + }); + }); }); diff --git a/src/ngx-translate-loaders/translate-browser.loader.ts b/src/ngx-translate-loaders/translate-browser.loader.ts index 93d20426591..efbd109c895 100644 --- a/src/ngx-translate-loaders/translate-browser.loader.ts +++ b/src/ngx-translate-loaders/translate-browser.loader.ts @@ -1,5 +1,7 @@ import { HttpClient } from '@angular/common/http'; import { TransferState } from '@angular/core'; +import { AppConfig } from '@dspace/config/app-config.interface'; +import { getDefaultThemeConfig } from '@dspace/config/config.util'; import { hasValue } from '@dspace/shared/utils/empty.util'; import { TranslateLoader } from '@ngx-translate/core'; import JSON5 from 'json5'; @@ -18,14 +20,16 @@ import { NGX_TRANSLATE_STATE, NgxTranslateState, } from './ngx-translate-state'; -import { resolveThemeLoadOrder } from './theme-i18n.util'; +import { resolveActiveThemeChain } from './theme-i18n.util'; /** * A TranslateLoader for ngx-translate to retrieve i18n messages from the TransferState, or download * them if they're not available there. * - * Also fetches per-theme translation overrides from `assets//i18n/.json5` for every - * configured theme and deep-merges them on top of the base translations (theme keys win). + * Also fetches per-theme translation overrides from `assets//i18n/.json5` for the + * active theme and its ancestors (root → active), merging them on top of the base translations + * so the active theme's keys win. Only the active theme's inheritance chain is loaded — sibling + * themes are excluded to prevent cross-theme key pollution. * This removes the need for the build-time `merge-i18n` script, allowing a single Docker image * to serve multiple customers with their own theme-specific translations. */ @@ -53,10 +57,11 @@ export class TranslateBrowserLoader implements TranslateLoader { return of(messages); } - // Fetch base translations + every configured theme's override file (in inheritance order) - // and merge them. Theme keys override base keys; child theme keys override parent theme keys. + // Fetch base translations + the active theme's override files (root ancestor → active theme). + // Only the active theme's inheritance chain is loaded; sibling themes are excluded. const base$ = this.fetchBase(lang); - const orderedThemes = resolveThemeLoadOrder(environment.themes ?? []); + const activeName = getDefaultThemeConfig(environment as unknown as AppConfig).name; + const orderedThemes = resolveActiveThemeChain(environment.themes ?? [], activeName); const themeStreams = orderedThemes.map((name: string) => this.fetchThemeOverride(name, lang)); return forkJoin([base$, ...themeStreams]).pipe( diff --git a/src/ngx-translate-loaders/translate-server.loader.ts b/src/ngx-translate-loaders/translate-server.loader.ts index 2c16a18dbad..d05912e03ba 100644 --- a/src/ngx-translate-loaders/translate-server.loader.ts +++ b/src/ngx-translate-loaders/translate-server.loader.ts @@ -8,6 +8,7 @@ import { } from 'node:path'; import { TransferState } from '@angular/core'; +import { getDefaultThemeConfig } from '@dspace/config/config.util'; import { TranslateLoader } from '@ngx-translate/core'; import JSON5 from 'json5'; import { @@ -20,14 +21,16 @@ import { NGX_TRANSLATE_STATE, NgxTranslateState, } from './ngx-translate-state'; -import { resolveThemeLoadOrder } from './theme-i18n.util'; +import { resolveActiveThemeChain } from './theme-i18n.util'; /** * A TranslateLoader for ngx-translate to parse json5 files server-side, and store them in the * TransferState. * * Also overlays per-theme translation overrides from `//i18n/.json5` - * for every configured theme, merging them on top of the base translations (theme keys win). + * for the active theme and its ancestors (in root → active order), merging them on top of the + * base translations so the active theme's keys win. Only the active theme's inheritance chain is + * loaded — sibling themes are excluded to prevent cross-theme key pollution. * The resulting merged map is stored in the TransferState so the browser does not need to * re-fetch the theme overrides after the initial SSR response. */ @@ -61,7 +64,8 @@ export class TranslateServerLoader implements TranslateLoader { } /** - * Read and merge i18n override files from every configured theme's assets folder. + * Read and merge i18n override files for the active theme's inheritance chain. + * Only the active theme (and its ancestors) are loaded; sibling themes are excluded. * Returns an empty object if no overrides are present. * * @param lang the language code @@ -73,9 +77,9 @@ export class TranslateServerLoader implements TranslateLoader { return {}; } - // Build the ordered list of themes to load, expanding each configured theme's inheritance - // chain (ancestor first, descendant last) so that child theme overrides win over parents. - const orderedThemes = resolveThemeLoadOrder(configured); + // Resolve only the active theme's chain (root ancestor → active theme). + const activeName = getDefaultThemeConfig(environment).name; + const orderedThemes = resolveActiveThemeChain(configured, activeName); // `this.prefix` looks like `dist/server/assets/i18n/`. Theme assets live next to `i18n/` // at `dist/server/assets//i18n/.json5`. From c594b07a73a0d42e4c8d038b00351a3fb4e545f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan=C3=A1sz-Nagy=20Zolt=C3=A1n?= Date: Thu, 4 Jun 2026 21:55:02 +0200 Subject: [PATCH 06/79] QREPO-405 fix type cast for getDefaultThemeConfig in server loader --- src/ngx-translate-loaders/translate-server.loader.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ngx-translate-loaders/translate-server.loader.ts b/src/ngx-translate-loaders/translate-server.loader.ts index d05912e03ba..82b331bd4c0 100644 --- a/src/ngx-translate-loaders/translate-server.loader.ts +++ b/src/ngx-translate-loaders/translate-server.loader.ts @@ -8,6 +8,7 @@ import { } from 'node:path'; import { TransferState } from '@angular/core'; +import { AppConfig } from '@dspace/config/app-config.interface'; import { getDefaultThemeConfig } from '@dspace/config/config.util'; import { TranslateLoader } from '@ngx-translate/core'; import JSON5 from 'json5'; @@ -78,7 +79,7 @@ export class TranslateServerLoader implements TranslateLoader { } // Resolve only the active theme's chain (root ancestor → active theme). - const activeName = getDefaultThemeConfig(environment).name; + const activeName = getDefaultThemeConfig(environment as unknown as AppConfig).name; const orderedThemes = resolveActiveThemeChain(configured, activeName); // `this.prefix` looks like `dist/server/assets/i18n/`. Theme assets live next to `i18n/` From 11cf30e1399ef9d7fa1a091aac27534ca488ffda Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Thu, 23 Jul 2026 19:21:31 +0200 Subject: [PATCH 07/79] 143742: Fix hideReturnButton not being configurable on nested routes Also used margin bottom on the EditItemPageComponent tabs to allign the spacing with the comcol pages --- .../collection-item-mapper.component.html | 13 ++++++++++--- .../edit-collection-page.component.spec.ts | 1 + .../edit-community-page.component.spec.ts | 1 + .../edit-item-page/edit-item-page.component.html | 4 ++-- .../edit-item-page.component.spec.ts | 1 + .../edit-item-page/edit-item-page.component.ts | 11 +++++++++++ .../edit-item-page.routing.module.ts | 12 +++++------- .../item-collection-mapper.component.html | 15 +++++++++++---- .../item-curate/item-curate.component.html | 2 +- .../item-status/item-status.component.html | 2 +- .../item-version-history.component.html | 2 +- .../edit-comcol-page.component.spec.ts | 1 + .../edit-comcol-page.component.ts | 8 ++++++-- .../collection-select.component.html | 2 +- .../item-select/item-select.component.html | 10 ++++++---- 15 files changed, 59 insertions(+), 26 deletions(-) diff --git a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html index a48c4d15bfd..f720d9aee90 100644 --- a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html +++ b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html @@ -50,9 +50,16 @@

{{'collection.edit.item-mapper.head' | translate}}

(confirm)="mapItems($event)" (cancel)="onCancel()">
- + + +
+ +
+
diff --git a/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts b/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts index 00f05f50c0f..aaf07290bf7 100644 --- a/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts @@ -28,6 +28,7 @@ describe('EditCollectionPageComponent', () => { ] }, snapshot: { + data: {}, firstChild: { routeConfig: { path: 'mockUrl' diff --git a/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts b/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts index 3a4c3351c32..710ba06458c 100644 --- a/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts +++ b/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts @@ -28,6 +28,7 @@ describe('EditCommunityPageComponent', () => { ] }, snapshot: { + data: {}, firstChild: { routeConfig: { path: 'mockUrl' diff --git a/src/app/item-page/edit-item-page/edit-item-page.component.html b/src/app/item-page/edit-item-page/edit-item-page.component.html index c370fe4f20d..1130fcd61a6 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.component.html +++ b/src/app/item-page/edit-item-page/edit-item-page.component.html @@ -3,7 +3,7 @@

{{'item.edit.head' | translate}}

diff --git a/src/app/item-page/edit-item-page/edit-item-page.component.spec.ts b/src/app/item-page/edit-item-page/edit-item-page.component.spec.ts index 2521f7e67d5..03cebcbd93c 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.component.spec.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.component.spec.ts @@ -30,6 +30,7 @@ describe('ItemPageComponent', () => { const inaccesiblePages = ['inaccessible', 'inaccessibleDoubleGuard']; const mockRoute = { snapshot: { + data: {}, firstChild: { routeConfig: { path: accesiblePages[0] diff --git a/src/app/item-page/edit-item-page/edit-item-page.component.ts b/src/app/item-page/edit-item-page/edit-item-page.component.ts index 652b85916e9..2c55d5a4522 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.component.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.component.ts @@ -38,6 +38,11 @@ export class EditItemPageComponent implements OnInit { */ pages: { page: string, enabled: Observable }[]; + /** + * Hide the default return button? + */ + public hideReturnButton: boolean; + constructor(private route: ActivatedRoute, private router: Router, private injector: Injector) { this.router.events.subscribe(() => this.initPageParamsByRoute()); } @@ -75,5 +80,11 @@ export class EditItemPageComponent implements OnInit { */ initPageParamsByRoute() { this.currentPage = this.route.snapshot.firstChild.routeConfig.path; + + let current: ActivatedRoute = this.route; + while (current.firstChild) { + current = current.firstChild; + } + this.hideReturnButton = current.snapshot.data.hideReturnButton ?? false; } } diff --git a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts index f22027916fe..24abeeb5b13 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts +++ b/src/app/item-page/edit-item-page/edit-item-page.routing.module.ts @@ -101,12 +101,6 @@ import { ItemAccessControlComponent } from './item-access-control/item-access-co component: ItemBitstreamsComponent, data: { title: 'item.edit.tabs.view.title', showBreadcrumbs: true } }, */ - /* TODO - uncomment & fix when curate page exists - { - path: 'curate', - component: ItemBitstreamsComponent, - data: { title: 'item.edit.tabs.curate.title', showBreadcrumbs: true } - }, */ { path: 'versionhistory', component: ItemVersionHistoryComponent, @@ -121,7 +115,11 @@ import { ItemAccessControlComponent } from './item-access-control/item-access-co { path: 'mapper', component: ItemCollectionMapperComponent, - data: { title: 'item.edit.tabs.item-mapper.title', showBreadcrumbs: true }, + data: { + hideReturnButton: true, + title: 'item.edit.tabs.item-mapper.title', + showBreadcrumbs: true, + }, canActivate: [ItemPageCollectionMapperGuard] } ] diff --git a/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html b/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html index c522b8a9c53..7629a87ae07 100644 --- a/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html +++ b/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html @@ -1,4 +1,4 @@ -
+

{{'item.edit.item-mapper.head' | translate}}

@@ -48,9 +48,16 @@

{{'item.edit.item-mapper.head' | translate}}

(confirm)="mapCollections($event)" (cancel)="onCancel()">
- + + +
+ +
+
diff --git a/src/app/item-page/edit-item-page/item-curate/item-curate.component.html b/src/app/item-page/edit-item-page/item-curate/item-curate.component.html index 7c7ed41bd96..84763fadfd1 100644 --- a/src/app/item-page/edit-item-page/item-curate/item-curate.component.html +++ b/src/app/item-page/edit-item-page/item-curate/item-curate.component.html @@ -1,4 +1,4 @@ -
+

{{'item.edit.curate.title' |translate:{item: (itemName$ |async)} }}

{{'item.edit.tabs.status.description' | translate}}

+

{{'item.edit.tabs.status.description' | translate}}

diff --git a/src/app/item-page/edit-item-page/item-version-history/item-version-history.component.html b/src/app/item-page/edit-item-page/item-version-history/item-version-history.component.html index ec0c345d821..032ad6d4ce5 100644 --- a/src/app/item-page/edit-item-page/item-version-history/item-version-history.component.html +++ b/src/app/item-page/edit-item-page/item-version-history/item-version-history.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts index d3d936c9f75..dc00b2a3f04 100644 --- a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts +++ b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.spec.ts @@ -49,6 +49,7 @@ describe('EditComColPageComponent', () => { ] }, snapshot: { + data: {}, firstChild: { routeConfig: { path: 'mockUrl' diff --git a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts index e4d6c9c8a74..474a2558e1c 100644 --- a/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts +++ b/src/app/shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.ts @@ -70,7 +70,11 @@ export class EditComColPageComponent implements On */ initPageParamsByRoute() { this.currentPage = this.route.snapshot.firstChild.routeConfig.path; - this.hideReturnButton = this.route.routeConfig.children - .find((child: any) => child.path === this.currentPage).data.hideReturnButton; + + let current: ActivatedRoute = this.route; + while (current.firstChild) { + current = current.firstChild; + } + this.hideReturnButton = current.snapshot.data.hideReturnButton ?? false; } } diff --git a/src/app/shared/object-select/collection-select/collection-select.component.html b/src/app/shared/object-select/collection-select/collection-select.component.html index 9b87f69c040..95a2175811d 100644 --- a/src/app/shared/object-select/collection-select/collection-select.component.html +++ b/src/app/shared/object-select/collection-select/collection-select.component.html @@ -37,7 +37,7 @@ [ngClass]="{'btn-danger': dangerConfirm, 'btn-primary': !dangerConfirm}" [disabled]="selectedIds?.length === 0" (click)="confirmSelected()"> - {{confirmButton | translate}} + {{confirmButton | translate}}
diff --git a/src/app/shared/object-select/item-select/item-select.component.html b/src/app/shared/object-select/item-select/item-select.component.html index 7f8ff943a37..ec8e14c91fc 100644 --- a/src/app/shared/object-select/item-select/item-select.component.html +++ b/src/app/shared/object-select/item-select/item-select.component.html @@ -39,13 +39,15 @@
-
- - +
From ee02631aa3c586c5c9b15dc87f88644af662a18e Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Thu, 30 Jul 2026 17:23:30 +0200 Subject: [PATCH 08/79] 143742: Added aria-hidden attributes to FontAwesome icons --- .../collection-item-mapper.component.html | 2 +- .../item-page/edit-item-page/edit-item-page.component.html | 4 +++- .../item-collection-mapper.component.html | 2 +- .../collection-select/collection-select.component.html | 4 ++-- .../object-select/item-select/item-select.component.html | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html index bf5a5246ea5..a5db61cfbe4 100644 --- a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html +++ b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.html @@ -57,7 +57,7 @@

{{'collection.edit.item-mapper.head' | translate}}

} diff --git a/src/app/item-page/edit-item-page/edit-item-page.component.html b/src/app/item-page/edit-item-page/edit-item-page.component.html index dbb58883ece..7ae34ef2b18 100644 --- a/src/app/item-page/edit-item-page/edit-item-page.component.html +++ b/src/app/item-page/edit-item-page/edit-item-page.component.html @@ -37,7 +37,9 @@

{{'item.edit.head' | translate}}

diff --git a/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html b/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html index 7f7a2e052e2..a3a9d4719f9 100644 --- a/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html +++ b/src/app/item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html @@ -55,7 +55,7 @@

{{'item.edit.item-mapper.head' | translate}}

} diff --git a/src/app/shared/object-select/collection-select/collection-select.component.html b/src/app/shared/object-select/collection-select/collection-select.component.html index ae579773102..815917b892a 100644 --- a/src/app/shared/object-select/collection-select/collection-select.component.html +++ b/src/app/shared/object-select/collection-select/collection-select.component.html @@ -39,13 +39,13 @@ }
diff --git a/src/app/shared/object-select/item-select/item-select.component.html b/src/app/shared/object-select/item-select/item-select.component.html index 12476b7de4a..5385a6af9c5 100644 --- a/src/app/shared/object-select/item-select/item-select.component.html +++ b/src/app/shared/object-select/item-select/item-select.component.html @@ -59,13 +59,13 @@ }
From fe33f316b7bab534e983400a56dd26ae641db168 Mon Sep 17 00:00:00 2001 From: Hashim1999164 <64767361+Hashim1999164@users.noreply.github.com> Date: Fri, 31 Jul 2026 23:30:30 +0500 Subject: [PATCH 09/79] fix(cookies): skip Orejime init when consent popup is disabled Orejime requires a non-empty apps list, so initializing with apps=[] when enableCookieConsentPopup is false logged a console error. Return early instead and guard showSettings when no instance exists. Fixes #6009 --- .../cookies/browser-orejime.service.spec.ts | 22 +++++++++++++++++++ .../core/cookies/browser-orejime.service.ts | 15 ++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/app/core/cookies/browser-orejime.service.spec.ts b/src/app/core/cookies/browser-orejime.service.spec.ts index 7a293109ae1..fff423c585b 100644 --- a/src/app/core/cookies/browser-orejime.service.spec.ts +++ b/src/app/core/cookies/browser-orejime.service.spec.ts @@ -185,6 +185,28 @@ describe('BrowserOrejimeService', () => { }); }); + describe('initialize when cookie consent popup is disabled', () => { + it('should skip Orejime init so an empty apps list is never validated', () => { + const init = jasmine.createSpy('init'); + (service as any).appConfig = { + info: { + enablePrivacyStatement: true, + enableCookieConsentPopup: false, + }, + fallbackLanguage: 'en', + }; + (service as any).lazyOrejime = Promise.resolve({ init }); + spyOn(service, 'addAppMessages'); + spyOn(service, 'translateConfiguration'); + + service.initialize(); + + expect(service.addAppMessages).not.toHaveBeenCalled(); + expect(service.translateConfiguration).not.toHaveBeenCalled(); + expect(init).not.toHaveBeenCalled(); + }); + }); + it('addAppMessages', () => { service.addAppMessages(); expect(mockConfig.translations.zz[appName]).toBeDefined(); diff --git a/src/app/core/cookies/browser-orejime.service.ts b/src/app/core/cookies/browser-orejime.service.ts index 430d5c92cae..b9c9f85c345 100644 --- a/src/app/core/cookies/browser-orejime.service.ts +++ b/src/app/core/cookies/browser-orejime.service.ts @@ -124,6 +124,11 @@ export class BrowserOrejimeService extends OrejimeService { * - Add and translate orejime configuration messages */ initialize() { + // Orejime rejects an empty apps list; skip entirely when the consent UI is disabled. + if (!this.appConfig.info?.enableCookieConsentPopup) { + return; + } + if (!this.appConfig.info.enablePrivacyStatement) { this.orejimeConfig.translations.zz.consentModal.privacyPolicy.text = 'cookies.consent.content-modal.no-privacy-policy.text'; } @@ -195,11 +200,7 @@ export class BrowserOrejimeService extends OrejimeService { */ this.translateConfiguration(); - if (!this.appConfig.info?.enableCookieConsentPopup) { - this.orejimeConfig.apps = []; - } else { - this.orejimeConfig.apps = this.filterConfigApps(appsToHide); - } + this.orejimeConfig.apps = this.filterConfigApps(appsToHide); this.applyUpdateSettingsCallbackToApps(user); this.lazyOrejime.then(({ init }) => { this.orejimeInstance = init(this.orejimeConfig); @@ -328,7 +329,9 @@ export class BrowserOrejimeService extends OrejimeService { * Show the cookie consent form */ showSettings() { - this.orejimeInstance.show(); + if (hasValue(this.orejimeInstance)) { + this.orejimeInstance.show(); + } } /** From 35c3bacecaf00eec523956cbe8356294db124bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan=C3=A1sz-Nagy=20Zolt=C3=A1n?= Date: Thu, 27 Aug 2026 14:31:28 +0200 Subject: [PATCH 10/79] QREPO-405 adding documentation for theme-specific runtime translations --- README.md | 3 +- docs/ThemeTranslations.md | 86 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 docs/ThemeTranslations.md diff --git a/README.md b/README.md index 6400f698abb..af12ce02dd2 100644 --- a/README.md +++ b/README.md @@ -414,7 +414,8 @@ dspace-angular │ ├── docker-compose.yml * │ └── README.md * ├── docs * Folder for documentation -│ └── Configuration.md * Configuration documentation +│ ├── Configuration.md * Configuration documentation +│ └── ThemeTranslations.md * Theme-specific translations documentation ├── scripts * │ ├── merge-i18n-files.ts * │ ├── serve.ts * diff --git a/docs/ThemeTranslations.md b/docs/ThemeTranslations.md new file mode 100644 index 00000000000..1cebd9f99e0 --- /dev/null +++ b/docs/ThemeTranslations.md @@ -0,0 +1,86 @@ +# Theme-specific translations + +Themes can override individual translation keys, so a theme can rename a label or reword a +message without touching the shared language files. + +These overrides are applied **at runtime**, while the application is loading its translations. +The alternative is the build-time [`merge-i18n`](#relationship-to-merge-i18n) script, which merges +one theme's translations into the base language files before the build. Applying the overrides at +runtime means a single build - and therefore a single Docker image - can be deployed for different +themes, each with its own translations. + +## Adding translations to a theme + +Place the override files alongside the theme's other assets: + +``` +src/themes//assets/i18n/.json5 +``` + +For example: + +``` +src/assets/i18n/de.json5 * base translations (all keys) +src/themes/my-theme/assets/i18n/de.json5 * overrides for my-theme +``` + +An override file only has to contain the keys it changes; every other key falls back to the base +file. A theme also does not have to provide a file for every language. + +The build copies these files to `assets//i18n/.json5` in the output, where the +translate loaders pick them up. + +## How keys are resolved + +Translations are merged key by key. Later sources win: + +1. the base file, `src/assets/i18n/.json5` +2. the active theme's ancestors, starting from the root of the `extends` chain +3. the active theme itself + +Given this configuration: + +```yaml +themes: + - name: child-theme + extends: parent-theme + - name: parent-theme +``` + +with `child-theme` active, translations are merged in the order `base → parent-theme → +child-theme`. A key defined only in `parent-theme` is used unless `child-theme` redefines it, and a +key defined in neither falls back to the base file. This is the same `extends` inheritance that +DSpace already uses to resolve themed components. + +## Which theme's overrides are applied + +The overrides come from the **default theme** - the entry under `themes:` that has no `regex`, +`handle` or `uuid` matching rule - together with its ancestors. + +Configured themes outside that chain are deliberately skipped. Loading every configured theme +would let keys from unrelated themes overwrite one another, because the merged result is a single +flat map of keys. + +This also means that when one instance serves several themes selected by `regex`, `handle` or +`uuid`, only the default theme's translation overrides are applied. + +## Server-side rendering + +Under SSR the server loader reads the base file and the theme overrides from disk, merges them, +and stores the result in the Angular `TransferState`. The browser reuses that state, so no extra +request for theme translations is made after the initial page load. + +When no `TransferState` is available - client-side rendering, for example `npm run start:dev` - +the browser loader fetches the base file and the theme override files over HTTP and merges them +client-side. + +A missing override file is ignored. A malformed override file is skipped and a warning is written +to the server log, so a syntax error in one theme file cannot break rendering. + +## Relationship to `merge-i18n` + +Runtime overrides need no configuration change, and existing setups do not have to be migrated: +projects that run `npm run merge-i18n` before building keep working exactly as before. + +To use runtime overrides instead, keep `src/assets/i18n/.json5` as the unmodified base file +and do not run the script. From 299ec45daace36891bceec74d561be5005686783 Mon Sep 17 00:00:00 2001 From: bsarnii Date: Mon, 7 Sep 2026 20:49:39 +0200 Subject: [PATCH 11/79] fixing spacing between submit button and accessiblity card in the profile-page.component --- src/app/profile-page/profile-page.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/profile-page/profile-page.component.html b/src/app/profile-page/profile-page.component.html index 5d21b1578ab..117ed7b084a 100644 --- a/src/app/profile-page/profile-page.component.html +++ b/src/app/profile-page/profile-page.component.html @@ -32,7 +32,7 @@

{{'profile.title' | translate}}

} -
+
From 21ab7d3bd95a30596dad6acb328b5663175ac245 Mon Sep 17 00:00:00 2001 From: Emil Domagala Date: Tue, 8 Sep 2026 13:51:31 +0200 Subject: [PATCH 12/79] fix: using new eperson and group on init page instead of cashed --- .../shared/resource-policies/resource-policies.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/shared/resource-policies/resource-policies.component.ts b/src/app/shared/resource-policies/resource-policies.component.ts index 0dbc6a537cb..12f97c4ba04 100644 --- a/src/app/shared/resource-policies/resource-policies.component.ts +++ b/src/app/shared/resource-policies/resource-policies.component.ts @@ -199,7 +199,8 @@ export class ResourcePoliciesComponent implements OnInit, OnDestroy { initResourcePolicyList() { this.subs.push(this.resourcePolicyService.searchByResource( this.resourceUUID, null, false, true, - followLink('eperson'), followLink('group'), + followLink('eperson', { useCachedVersionIfAvailable: false, reRequestOnStale: true }), + followLink('group', { useCachedVersionIfAvailable: false, reRequestOnStale: true }), ).pipe( filter(() => this.isActive), getAllSucceededRemoteData(), From f4a9fc4b6a0ff4c2415caa06902a8ccbd90bda3c Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Fri, 12 Sep 2025 09:39:15 +0300 Subject: [PATCH 13/79] src/app/item-page: adjust grid in simple item view The Bootstrap grid is composed of 12 columns, but we are not using the entire grid, which could lead to unexpected stacking depending on the viewport size. This also adjusts the columns to be consist- ent with the sizing use by the search results page (3+9). --- .../simple/item-types/publication/publication.component.html | 4 ++-- .../item-types/untyped-item/untyped-item.component.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/item-page/simple/item-types/publication/publication.component.html b/src/app/item-page/simple/item-types/publication/publication.component.html index f5769793132..309327539ab 100644 --- a/src/app/item-page/simple/item-types/publication/publication.component.html +++ b/src/app/item-page/simple/item-types/publication/publication.component.html @@ -18,7 +18,7 @@
-
+
@if (!(mediaViewer.image || mediaViewer.video)) { @@ -61,7 +61,7 @@ urlRegex="^https?://">
-
+
@if (showDownloadLinkAsAttachment) { } diff --git a/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html b/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html index 7141a88a8e2..463af9c4ce2 100644 --- a/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html +++ b/src/app/item-page/simple/item-types/untyped-item/untyped-item.component.html @@ -19,7 +19,7 @@
-
+
@if (!(mediaViewer.image || mediaViewer.video)) { @@ -62,7 +62,7 @@ urlRegex="^https?://">
-
+
@if (showDownloadLinkAsAttachment) { } From c69186146fc645a82017b1d00e7b96e846593b4b Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 24 Feb 2026 19:45:10 +0300 Subject: [PATCH 14/79] src/app/entity-groups: adjust grid in entity item pages The Bootstrap grid is composed of 12 columns, but we are not using the entire grid, which could lead to unexpected stacking depending on the viewport size. This also adjusts the columns to be consist- ent with the sizing use by the search results page (3+9). --- .../item-pages/journal-issue/journal-issue.component.html | 4 ++-- .../item-pages/journal-volume/journal-volume.component.html | 4 ++-- .../item-pages/journal/journal.component.html | 4 ++-- .../item-pages/org-unit/org-unit.component.html | 4 ++-- .../research-entities/item-pages/person/person.component.html | 4 ++-- .../item-pages/project/project.component.html | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html index e26052285fc..9f97f7e0eda 100644 --- a/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html +++ b/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.html @@ -7,7 +7,7 @@
-
+
@@ -32,7 +32,7 @@ [label]="'journalissue.page.journal-issn'">
-
+
-
+
@@ -20,7 +20,7 @@ [label]="'journalvolume.page.issuedate'">
-
+
-
+
@@ -24,7 +24,7 @@ [label]="'journal.page.editor'">
-
+
-
+
-
+
-
+
-
+
-
+
-->
-
+
Date: Fri, 27 Feb 2026 09:41:34 +0300 Subject: [PATCH 15/79] src/styles: set max-width on item page fields Set max-width of item-page-field components to 75 characters. This is in line with some best practices regarding readability, though may need to be adjusted in the future. See the following recommendations: - 50 to 75 characters: https://baymard.com/blog/line-length-readability - 60 to 80 characters: https://pimpmytype.com/line-length-line-height/ - 50 to 75 characters: https://www.uxpin.com/studio/blog/optimal-line-length-for-readability/ - 50 to 75 characters: https://medium.com/@wblekhoa/talk-aboutthe-optimal-length-of-text-in-ux-ui-525e689f0b71 - Less than 80 characters: https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html --- src/styles/_custom_variables.scss | 1 + src/styles/_global-styles.scss | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/styles/_custom_variables.scss b/src/styles/_custom_variables.scss index 0a8a6757fb1..e8ae3549dd8 100644 --- a/src/styles/_custom_variables.scss +++ b/src/styles/_custom_variables.scss @@ -165,6 +165,7 @@ --ds-item-page-img-field-default-inline-height: 24px; + --ds-item-page-field-max-width: 75ch; --ds-qa-logo-width: 100px; diff --git a/src/styles/_global-styles.scss b/src/styles/_global-styles.scss index 6b794f06f64..3ead2664c24 100644 --- a/src/styles/_global-styles.scss +++ b/src/styles/_global-styles.scss @@ -573,3 +573,7 @@ ngb-tooltip-window { mask-size: contain; background-color: currentColor; } + +.item-page-field { + max-width: var(--ds-item-page-field-max-width); +} From ec77307c389773010832fb9e71425277eace9057 Mon Sep 17 00:00:00 2001 From: bram-atmire Date: Sun, 20 Sep 2026 20:22:50 +0200 Subject: [PATCH 16/79] Skip authenticated-only authorization checks for anonymous visitors An anonymous item render fires ~15 per-feature authorization checks, about ten of which ask about admin/edit/login-only capabilities an unauthenticated visitor can never hold. AuthorizationDataService.isAuthorized now answers false locally, without a REST call, for those features when no one is logged in, and waits for isAuthenticationLoaded() before deciding so authenticated users are never transiently treated as anonymous. Measured on a local DSpace 11 stack with OpenTelemetry tracing: an anonymous item render drops from 42 to 31 backend calls (15 to 5 authorization checks) and single-core SSR render throughput rises ~45%. Refs #6256, #3161 Co-authored-by: Claude Fable 5.1 --- .../authorization-data.service.spec.ts | 78 ++++++++++++++++++- .../authorization-data.service.ts | 54 +++++++++++++ .../item-select/item-select.component.spec.ts | 2 +- 3 files changed, 131 insertions(+), 3 deletions(-) diff --git a/src/app/core/data/feature-authorization/authorization-data.service.spec.ts b/src/app/core/data/feature-authorization/authorization-data.service.spec.ts index fb8a75815ed..071b63bf1bf 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.spec.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.spec.ts @@ -26,6 +26,7 @@ describe('AuthorizationDataService', () => { let service: AuthorizationDataService; let siteService: SiteDataService; let objectCache; + let authService; let site: Site; let ePerson: EPerson; @@ -48,8 +49,12 @@ describe('AuthorizationDataService', () => { siteService = jasmine.createSpyObj('siteService', { find: of(site), }); + authService = jasmine.createSpyObj('authService', { + isAuthenticated: of(true), + isAuthenticationLoaded: of(true), + }); objectCache = getMockObjectCacheService(); - service = new AuthorizationDataService(requestService, undefined, objectCache, undefined, siteService); + service = new AuthorizationDataService(requestService, undefined, objectCache, undefined, siteService, authService); } beforeEach(() => { @@ -58,7 +63,7 @@ describe('AuthorizationDataService', () => { }); describe('composition', () => { - const initService = () => new AuthorizationDataService(null, null, null, null, null); + const initService = () => new AuthorizationDataService(null, null, null, null, null, null); testSearchDataImplementation(initService); }); @@ -239,5 +244,74 @@ describe('AuthorizationDataService', () => { }); }); }); + + describe('for an authenticated-only feature when the current user is anonymous', () => { + // canEditItem is in AUTHENTICATED_ONLY_FEATURES; an anonymous user can never have it. + beforeEach(() => { + authService.isAuthenticationLoaded.and.returnValue(of(true)); + authService.isAuthenticated.and.returnValue(of(false)); + spyOn(service, 'searchByObject'); + }); + + it('should short-circuit to false without any REST call', (done) => { + service.isAuthorized(FeatureID.CanEditItem).subscribe((result) => { + expect(result).toEqual(false); + expect(service.searchByObject).not.toHaveBeenCalled(); + done(); + }); + }); + }); + + describe('for an authenticated-only feature when the current user IS authenticated', () => { + beforeEach(() => { + authService.isAuthenticationLoaded.and.returnValue(of(true)); + authService.isAuthenticated.and.returnValue(of(true)); + spyOn(service, 'searchByObject').and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(validPayload))); + }); + + it('should perform the normal check', (done) => { + service.isAuthorized(FeatureID.AdministratorOf).subscribe((result) => { + expect(service.searchByObject).toHaveBeenCalled(); + expect(result).toEqual(true); + done(); + }); + }); + }); + + describe('for a feature an anonymous user can legitimately have (e.g. canDownload)', () => { + beforeEach(() => { + authService.isAuthenticated.and.returnValue(of(false)); + authService.isAuthenticationLoaded.and.returnValue(of(true)); + spyOn(service, 'searchByObject').and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(emptyPayload))); + }); + + it('should still be checked normally, not skipped', (done) => { + service.isAuthorized(FeatureID.CanDownload).subscribe(() => { + expect(service.searchByObject).toHaveBeenCalled(); + done(); + }); + }); + }); + + describe('for an authenticated-only feature before authentication has finished loading', () => { + beforeEach(() => { + // not loaded yet -> must wait, never decide off the transient "false" + authService.isAuthenticationLoaded.and.returnValue(of(false)); + authService.isAuthenticated.and.returnValue(of(false)); + spyOn(service, 'searchByObject'); + }); + + it('should not emit or call searchByObject until authentication is loaded', (done) => { + let emitted = false; + service.isAuthorized(FeatureID.CanEditItem).subscribe(() => { + emitted = true; + }); + setTimeout(() => { + expect(emitted).toEqual(false); + expect(service.searchByObject).not.toHaveBeenCalled(); + done(); + }, 50); + }); + }); }); }); diff --git a/src/app/core/data/feature-authorization/authorization-data.service.ts b/src/app/core/data/feature-authorization/authorization-data.service.ts index afe0a4753de..9d1f9d1d016 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.ts @@ -12,8 +12,10 @@ import { } from 'rxjs'; import { catchError, + filter, map, switchMap, + take, } from 'rxjs/operators'; import { dataService } from '../../cache/builders/build-decorators'; @@ -37,6 +39,7 @@ import { PaginatedList } from '../paginated-list.model'; import { RemoteData } from '../remote-data'; import { RequestService } from '../request.service'; import { SiteDataService } from '../site-data.service'; +import { AuthService } from '../../auth/auth.service'; import { AuthorizationSearchParams } from './authorization-search-params'; import { oneAuthorizationMatchesFeature } from './authorization-utils'; import { FeatureID } from './feature-id'; @@ -53,12 +56,35 @@ export class AuthorizationDataService extends BaseDataService imp private searchData: SearchDataImpl; + /** + * Features that can only ever be granted to an authenticated user. For an anonymous visitor + * these are always false, so they are answered locally without a REST call (avoiding a backend + * lookup that re-resolves the user's groups and resource policies). Kept deliberately + * conservative: the features an unauthenticated visitor can legitimately be granted - canDownload, + * canRequestACopy, epersonRegistration, epersonForgotPassword, canSendFeedback and + * canViewUsageStatistics - are intentionally NOT listed here and are always checked normally. + */ + private static readonly AUTHENTICATED_ONLY_FEATURES: Set = new Set([ + FeatureID.LoginOnBehalfOf, FeatureID.AdministratorOf, FeatureID.CanDelete, + FeatureID.CanEditMetadata, FeatureID.WithdrawItem, FeatureID.ReinstateItem, + FeatureID.CanManageGroups, FeatureID.CanManageGroup, FeatureID.IsCollectionAdmin, + FeatureID.IsCommunityAdmin, FeatureID.CanChangePassword, FeatureID.CanManageVersions, + FeatureID.CanManageBitstreamBundles, FeatureID.CanManageRelationships, + FeatureID.CanManageMappings, FeatureID.CanManagePolicies, FeatureID.CanMakePrivate, + FeatureID.CanMove, FeatureID.CanEditVersion, FeatureID.CanDeleteVersion, + FeatureID.CanCreateVersion, FeatureID.CanClaimItem, FeatureID.CanSynchronizeWithORCID, + FeatureID.CanSubmit, FeatureID.CanEditItem, FeatureID.CanRegisterDOI, + FeatureID.CanSubscribe, FeatureID.CanSeeQA, FeatureID.CoarNotifyEnabled, + FeatureID.CanReplaceBitstreamSubmitter, FeatureID.CanReplaceBitstreamAdmin, + ]); + constructor( protected requestService: RequestService, protected rdbService: RemoteDataBuildService, protected objectCache: ObjectCacheService, protected halService: HALEndpointService, protected siteService: SiteDataService, + protected authService: AuthService, ) { super('authorizations', requestService, rdbService, objectCache, halService); @@ -85,6 +111,34 @@ export class AuthorizationDataService extends BaseDataService imp * requested after the response becomes stale */ isAuthorized(featureId?: FeatureID, objectUrl?: string, ePersonUuid?: string, useCachedVersionIfAvailable = true, reRequestOnStale = true): Observable { + // Access load is dominated by unauthenticated traffic (crawlers and browser-impersonating + // scrapers). For those visitors an admin/edit/manage feature can never be granted, yet each + // check would otherwise trigger a REST call that re-resolves the user's groups and resource + // policies in the backend - a well-known source of excessive DB queries per page. So when we + // are checking the *current* user for a feature that only makes sense once logged in, answer + // "false" locally without any request whenever nobody is authenticated. + if (hasValue(featureId) && hasNoValue(ePersonUuid) && AuthorizationDataService.AUTHENTICATED_ONLY_FEATURES.has(featureId)) { + // Wait until authentication has finished loading before deciding. The auth store starts in an + // un-loaded state where "authenticated" reads false, so reading it too early could momentarily + // treat a genuinely logged-in user as anonymous and hide these controls from them. Only once + // authentication is loaded do we read the settled value: if still not authenticated, the answer + // is "false" locally with no REST call; otherwise we perform the normal check. + return this.authService.isAuthenticationLoaded().pipe( + filter((loaded: boolean) => loaded), + take(1), + switchMap(() => this.authService.isAuthenticated().pipe(take(1))), + switchMap((authenticated: boolean) => authenticated + ? this.checkAuthorization(featureId, objectUrl, ePersonUuid, useCachedVersionIfAvailable, reRequestOnStale) + : of(false)), + ); + } + return this.checkAuthorization(featureId, objectUrl, ePersonUuid, useCachedVersionIfAvailable, reRequestOnStale); + } + + /** + * Perform the actual authorization lookup for a single feature against the REST API. + */ + private checkAuthorization(featureId?: FeatureID, objectUrl?: string, ePersonUuid?: string, useCachedVersionIfAvailable = true, reRequestOnStale = true): Observable { return this.searchByObject(featureId, objectUrl, ePersonUuid, {}, useCachedVersionIfAvailable, reRequestOnStale, followLink('feature')).pipe( getFirstCompletedRemoteData(), map((authorizationRD) => { diff --git a/src/app/shared/object-select/item-select/item-select.component.spec.ts b/src/app/shared/object-select/item-select/item-select.component.spec.ts index 3d5d665e4c3..3a288a5ec47 100644 --- a/src/app/shared/object-select/item-select/item-select.component.spec.ts +++ b/src/app/shared/object-select/item-select/item-select.component.spec.ts @@ -79,7 +79,7 @@ describe('ItemSelectComponent', () => { paginationService = new PaginationServiceStub(mockPaginationOptions); - const authorizationDataService = new AuthorizationDataService(null, null, null, null, null); + const authorizationDataService = new AuthorizationDataService(null, null, null, null, null, null); const linkHeadService = jasmine.createSpyObj('linkHeadService', { addTag: '', From 0a36bb02e847d8510d7af30f9a3c8363679ec1af Mon Sep 17 00:00:00 2001 From: bram-atmire Date: Sat, 26 Sep 2026 15:14:40 +0200 Subject: [PATCH 17/79] Batch anonymous authorization checks per object --- src/app/core/auth/auth.service.spec.ts | 15 ++ src/app/core/auth/auth.service.ts | 10 ++ .../authorization-data.service.spec.ts | 145 ++++++++++++------ .../authorization-data.service.ts | 87 ++++++----- 4 files changed, 171 insertions(+), 86 deletions(-) diff --git a/src/app/core/auth/auth.service.spec.ts b/src/app/core/auth/auth.service.spec.ts index 4c4efc2f62b..bc54c69ea0a 100644 --- a/src/app/core/auth/auth.service.spec.ts +++ b/src/app/core/auth/auth.service.spec.ts @@ -52,6 +52,8 @@ import { import { getMockTranslateService } from '../testing/translate.service.mock'; import { createSuccessfulRemoteDataObject$ } from '../utilities/remote-data.utils'; import { + CheckAuthenticationTokenAction, + RetrieveAuthMethodsSuccessAction, SetUserAsIdleAction, UnsetUserAsIdleAction, } from './auth.actions'; @@ -195,6 +197,19 @@ describe('AuthService test', () => { mockStore.setState(initialState); }); + it('should become ready after anonymous authentication initialization without a loaded flag', () => { + const pending = authReducer(undefined, new CheckAuthenticationTokenAction()); + mockStore.setState({ core: { auth: pending } } as any); + const results: boolean[] = []; + const subscription = authService.isAuthenticationReady().subscribe((ready) => results.push(ready)); + const anonymous = authReducer(pending, new RetrieveAuthMethodsSuccessAction([])); + expect(anonymous.loaded).toBeFalse(); + expect(anonymous.authenticated).toBeFalse(); + mockStore.setState({ core: { auth: anonymous } } as any); + expect(results).toEqual([false, true]); + subscription.unsubscribe(); + }); + it('should return the authentication status object when user credentials are correct', () => { authService.authenticate('user', 'password').subscribe((status: AuthStatus) => { expect(status).toBeDefined(); diff --git a/src/app/core/auth/auth.service.ts b/src/app/core/auth/auth.service.ts index a762c857626..bbaec730718 100644 --- a/src/app/core/auth/auth.service.ts +++ b/src/app/core/auth/auth.service.ts @@ -86,6 +86,7 @@ import { getRedirectUrl, isAuthenticated, isAuthenticatedLoaded, + isAuthenticationBlocking, isIdle, isTokenRefreshing, } from './selectors'; @@ -190,6 +191,15 @@ export class AuthService { return this.store.pipe(select(isAuthenticatedLoaded)); } + /** + * Whether authentication initialization has finished, including anonymous sessions. + * Uses the same readiness condition as application initialization; anonymous sessions + * can finish loading their authentication methods without setting the loaded flag. + */ + public isAuthenticationReady(): Observable { + return this.store.pipe(select(isAuthenticationBlocking), map((blocking) => blocking === false)); + } + /** * Used to set the external authentication status when authenticating via an * external authentication system (e.g. Shibboleth). diff --git a/src/app/core/data/feature-authorization/authorization-data.service.spec.ts b/src/app/core/data/feature-authorization/authorization-data.service.spec.ts index 071b63bf1bf..2f89d667047 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.spec.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.spec.ts @@ -1,8 +1,10 @@ import { hasValue } from '@dspace/shared/utils/empty.util'; import { + BehaviorSubject, combineLatest as observableCombineLatest, Observable, of, + throwError, } from 'rxjs'; import { RequestParam } from '../../cache/models/request-param.model'; @@ -51,7 +53,7 @@ describe('AuthorizationDataService', () => { }); authService = jasmine.createSpyObj('authService', { isAuthenticated: of(true), - isAuthenticationLoaded: of(true), + isAuthenticationReady: of(true), }); objectCache = getMockObjectCacheService(); service = new AuthorizationDataService(requestService, undefined, objectCache, undefined, siteService, authService); @@ -245,72 +247,119 @@ describe('AuthorizationDataService', () => { }); }); - describe('for an authenticated-only feature when the current user is anonymous', () => { - // canEditItem is in AUTHENTICATED_ONLY_FEATURES; an anonymous user can never have it. + describe('anonymous authorization batching', () => { + let search: jasmine.Spy; beforeEach(() => { - authService.isAuthenticationLoaded.and.returnValue(of(true)); authService.isAuthenticated.and.returnValue(of(false)); - spyOn(service, 'searchByObject'); + search = spyOn(service, 'searchByObject').and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(validPayload))); }); - it('should short-circuit to false without any REST call', (done) => { - service.isAuthorized(FeatureID.CanEditItem).subscribe((result) => { - expect(result).toEqual(false); - expect(service.searchByObject).not.toHaveBeenCalled(); - done(); - }); + it('should use the same unfiltered object request for different anonymous features', () => { + const results = []; + service.isAuthorized(featureID, 'item-url').subscribe((value) => results.push(value)); + service.isAuthorized(FeatureID.CanCreateVersion, 'item-url').subscribe((value) => results.push(value)); + expect(results).toEqual([true, false]); + expect(search.calls.count()).toBe(2); + expect(search.calls.argsFor(0)).toEqual(search.calls.argsFor(1)); + expect(search).toHaveBeenCalledWith(undefined, 'item-url', undefined, { elementsPerPage: 100 }, true, true, jasmine.anything()); }); - }); - describe('for an authenticated-only feature when the current user IS authenticated', () => { - beforeEach(() => { - authService.isAuthenticationLoaded.and.returnValue(of(true)); - authService.isAuthenticated.and.returnValue(of(true)); - spyOn(service, 'searchByObject').and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(validPayload))); + it('should resolve the site URL for checks without an object', () => { + service.isAuthorized(featureID).subscribe((value) => expect(value).toBeTrue()); + expect(search).toHaveBeenCalledWith(undefined, site.self, undefined, { elementsPerPage: 100 }, true, true, jasmine.anything()); }); - it('should perform the normal check', (done) => { - service.isAuthorized(FeatureID.AdministratorOf).subscribe((result) => { - expect(service.searchByObject).toHaveBeenCalled(); - expect(result).toEqual(true); - done(); + [FeatureID.CanSeeQA, FeatureID.CoarNotifyEnabled, FeatureID.CanDownload, FeatureID.CanEditItem, + FeatureID.CanEditMetadata, FeatureID.CanManageRelationships, FeatureID.CanCreateVersion].forEach((feature) => { + it(`should preserve the backend result for ${feature}`, () => { + const grant = Object.assign(new Authorization(), { + feature: createSuccessfulRemoteDataObject$(Object.assign(new Feature(), { id: feature })), + }); + search.and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList([grant]))); + service.isAuthorized(feature).subscribe((result) => expect(result).toBeTrue()); }); }); - }); - describe('for a feature an anonymous user can legitimately have (e.g. canDownload)', () => { - beforeEach(() => { - authService.isAuthenticated.and.returnValue(of(false)); - authService.isAuthenticationLoaded.and.returnValue(of(true)); - spyOn(service, 'searchByObject').and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(emptyPayload))); + it('should follow pagination before deciding a feature is absent', () => { + const first = createPaginatedList(invalidPayload); + first._links.next = { href: 'next-page' }; + search.and.returnValue(createSuccessfulRemoteDataObject$(first)); + const next = spyOn(service, 'findListByHref').and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(validPayload))); + spyOn(service as any, 'addDependency'); + service.isAuthorized(featureID, 'item-url', undefined, false, false).subscribe((value) => expect(value).toBeTrue()); + expect(next).toHaveBeenCalledWith('next-page', {}, false, false, jasmine.anything()); + expect((service as any).addDependency).toHaveBeenCalled(); }); - it('should still be checked normally, not skipped', (done) => { - service.isAuthorized(FeatureID.CanDownload).subscribe(() => { - expect(service.searchByObject).toHaveBeenCalled(); - done(); + [401, 403, 404, 500].forEach((status) => { + it(`should fall back to the individual check when the batch fails (${status})`, () => { + search.and.callFake((feature) => feature + ? createSuccessfulRemoteDataObject$(createPaginatedList(validPayload)) + : createFailedRemoteDataObject$('Batch failed', status)); + service.isAuthorized(featureID, 'item-url', undefined, false, false).subscribe((value) => expect(value).toBeTrue()); + expect(search).toHaveBeenCalledWith(featureID, 'item-url', undefined, {}, false, false, jasmine.anything()); }); }); - }); - describe('for an authenticated-only feature before authentication has finished loading', () => { - beforeEach(() => { - // not loaded yet -> must wait, never decide off the transient "false" - authService.isAuthenticationLoaded.and.returnValue(of(false)); - authService.isAuthenticated.and.returnValue(of(false)); - spyOn(service, 'searchByObject'); + it('should fall back on thrown errors', () => { + search.and.callFake((feature) => feature + ? createSuccessfulRemoteDataObject$(createPaginatedList(validPayload)) + : throwError(() => new Error('Batch failed'))); + service.isAuthorized(featureID).subscribe((value) => expect(value).toBeTrue()); + }); + + it('should discard partial grants if a later page fails', () => { + const first = createPaginatedList(validPayload); + first._links.next = { href: 'failed-page' }; + search.and.callFake((feature) => createSuccessfulRemoteDataObject$(feature ? createPaginatedList([]) : first)); + spyOn(service, 'findListByHref').and.returnValue(createFailedRemoteDataObject$('Failed', 500)); + spyOn(service as any, 'addDependency'); + service.isAuthorized(featureID).subscribe((value) => expect(value).toBeFalse()); + expect(search).toHaveBeenCalledTimes(2); }); - it('should not emit or call searchByObject until authentication is loaded', (done) => { - let emitted = false; - service.isAuthorized(FeatureID.CanEditItem).subscribe(() => { - emitted = true; + it('should retain individual checks for authenticated visitors', () => { + authService.isAuthenticated.and.returnValue(of(true)); + service.isAuthorized(featureID).subscribe((result) => expect(result).toBeTrue()); + expect(search).toHaveBeenCalledOnceWith(featureID, undefined, undefined, {}, true, true, jasmine.anything()); + }); + + it('should retain explicit EPerson requests and request cache options', () => { + service.isAuthorized(featureID, 'object-url', 'eperson-uuid', false, false).subscribe(); + expect(search).toHaveBeenCalledOnceWith(featureID, 'object-url', 'eperson-uuid', {}, false, false, jasmine.anything()); + }); + + it('should leave requests without a specific feature unchanged', () => { + search.and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList([]))); + service.isAuthorized().subscribe(); + expect(search).toHaveBeenCalledOnceWith(undefined, undefined, undefined, {}, true, true, jasmine.anything()); + }); + + [true, false].forEach((authenticated) => { + it(`should wait until authentication is ready (authenticated: ${authenticated})`, () => { + const ready$ = new BehaviorSubject(false); + const authenticated$ = new BehaviorSubject(false); + authService.isAuthenticationReady.and.returnValue(ready$); + authService.isAuthenticated.and.returnValue(authenticated$); + const result = jasmine.createSpy('result'); + service.isAuthorized(featureID, 'item-url').subscribe(result); + expect(result).not.toHaveBeenCalled(); + expect(search).not.toHaveBeenCalled(); + authenticated$.next(authenticated); + ready$.next(true); + expect(result).toHaveBeenCalledOnceWith(true); + expect(search.calls.mostRecent().args[0]).toEqual(authenticated ? featureID : undefined); }); - setTimeout(() => { - expect(emitted).toEqual(false); - expect(service.searchByObject).not.toHaveBeenCalled(); - done(); - }, 50); + }); + + it('should reconsider authentication on subsequent calls after login', () => { + service.isAuthorized(featureID, 'item-url').subscribe(); + authService.isAuthenticated.and.returnValue(of(true)); + service.invalidateAuthorizationsRequestCache(); + service.isAuthorized(featureID, 'item-url').subscribe(); + expect(search.calls.argsFor(0)[0]).toBeUndefined(); + expect(search.calls.argsFor(1)[0]).toBe(featureID); + expect(requestService.setStaleByHrefSubstring).toHaveBeenCalledWith('authorizations'); }); }); }); diff --git a/src/app/core/data/feature-authorization/authorization-data.service.ts b/src/app/core/data/feature-authorization/authorization-data.service.ts index 9d1f9d1d016..437f3e55f65 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.ts @@ -7,17 +7,22 @@ import { isNotEmpty, } from '@dspace/shared/utils/empty.util'; import { + defer, + EMPTY, Observable, of, } from 'rxjs'; import { catchError, + expand, filter, map, + reduce, switchMap, take, } from 'rxjs/operators'; +import { AuthService } from '../../auth/auth.service'; import { dataService } from '../../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service'; import { RequestParam } from '../../cache/models/request-param.model'; @@ -39,7 +44,6 @@ import { PaginatedList } from '../paginated-list.model'; import { RemoteData } from '../remote-data'; import { RequestService } from '../request.service'; import { SiteDataService } from '../site-data.service'; -import { AuthService } from '../../auth/auth.service'; import { AuthorizationSearchParams } from './authorization-search-params'; import { oneAuthorizationMatchesFeature } from './authorization-utils'; import { FeatureID } from './feature-id'; @@ -56,28 +60,6 @@ export class AuthorizationDataService extends BaseDataService imp private searchData: SearchDataImpl; - /** - * Features that can only ever be granted to an authenticated user. For an anonymous visitor - * these are always false, so they are answered locally without a REST call (avoiding a backend - * lookup that re-resolves the user's groups and resource policies). Kept deliberately - * conservative: the features an unauthenticated visitor can legitimately be granted - canDownload, - * canRequestACopy, epersonRegistration, epersonForgotPassword, canSendFeedback and - * canViewUsageStatistics - are intentionally NOT listed here and are always checked normally. - */ - private static readonly AUTHENTICATED_ONLY_FEATURES: Set = new Set([ - FeatureID.LoginOnBehalfOf, FeatureID.AdministratorOf, FeatureID.CanDelete, - FeatureID.CanEditMetadata, FeatureID.WithdrawItem, FeatureID.ReinstateItem, - FeatureID.CanManageGroups, FeatureID.CanManageGroup, FeatureID.IsCollectionAdmin, - FeatureID.IsCommunityAdmin, FeatureID.CanChangePassword, FeatureID.CanManageVersions, - FeatureID.CanManageBitstreamBundles, FeatureID.CanManageRelationships, - FeatureID.CanManageMappings, FeatureID.CanManagePolicies, FeatureID.CanMakePrivate, - FeatureID.CanMove, FeatureID.CanEditVersion, FeatureID.CanDeleteVersion, - FeatureID.CanCreateVersion, FeatureID.CanClaimItem, FeatureID.CanSynchronizeWithORCID, - FeatureID.CanSubmit, FeatureID.CanEditItem, FeatureID.CanRegisterDOI, - FeatureID.CanSubscribe, FeatureID.CanSeeQA, FeatureID.CoarNotifyEnabled, - FeatureID.CanReplaceBitstreamSubmitter, FeatureID.CanReplaceBitstreamAdmin, - ]); - constructor( protected requestService: RequestService, protected rdbService: RemoteDataBuildService, @@ -111,30 +93,59 @@ export class AuthorizationDataService extends BaseDataService imp * requested after the response becomes stale */ isAuthorized(featureId?: FeatureID, objectUrl?: string, ePersonUuid?: string, useCachedVersionIfAvailable = true, reRequestOnStale = true): Observable { - // Access load is dominated by unauthenticated traffic (crawlers and browser-impersonating - // scrapers). For those visitors an admin/edit/manage feature can never be granted, yet each - // check would otherwise trigger a REST call that re-resolves the user's groups and resource - // policies in the backend - a well-known source of excessive DB queries per page. So when we - // are checking the *current* user for a feature that only makes sense once logged in, answer - // "false" locally without any request whenever nobody is authenticated. - if (hasValue(featureId) && hasNoValue(ePersonUuid) && AuthorizationDataService.AUTHENTICATED_ONLY_FEATURES.has(featureId)) { - // Wait until authentication has finished loading before deciding. The auth store starts in an - // un-loaded state where "authenticated" reads false, so reading it too early could momentarily - // treat a genuinely logged-in user as anonymous and hide these controls from them. Only once - // authentication is loaded do we read the settled value: if still not authenticated, the answer - // is "false" locally with no REST call; otherwise we perform the normal check. - return this.authService.isAuthenticationLoaded().pipe( - filter((loaded: boolean) => loaded), + if (hasValue(featureId) && hasNoValue(ePersonUuid)) { + // An unresolved authentication state must never be mistaken for an anonymous visitor. + return this.authService.isAuthenticationReady().pipe( + filter((ready: boolean) => ready), take(1), switchMap(() => this.authService.isAuthenticated().pipe(take(1))), switchMap((authenticated: boolean) => authenticated ? this.checkAuthorization(featureId, objectUrl, ePersonUuid, useCachedVersionIfAvailable, reRequestOnStale) - : of(false)), + : this.checkAnonymousAuthorization(featureId, objectUrl, useCachedVersionIfAvailable, reRequestOnStale)), ); } return this.checkAuthorization(featureId, objectUrl, ePersonUuid, useCachedVersionIfAvailable, reRequestOnStale); } + /** + * Anonymous feature checks for the same object share the existing unfiltered REST search. + * The request cache deduplicates pending requests and retains its normal expiry, dependency + * invalidation and SSR transfer behavior. No permissions are cached separately here. + * Follow every page before deciding a feature is absent. A failed batch (including a custom + * feature throwing on the backend) falls back to the original individual feature check. + */ + private checkAnonymousAuthorization(featureId: FeatureID, objectUrl: string, useCachedVersionIfAvailable: boolean, reRequestOnStale: boolean): Observable { + const objectUrl$ = hasValue(objectUrl) ? of(objectUrl) : this.siteService.find().pipe(map((site) => site.self)); + return objectUrl$.pipe( + take(1), + switchMap((url: string) => { + const readPage = (response$: Observable>>) => response$.pipe( + getFirstCompletedRemoteData(), + map((response) => { + if (!response.hasSucceeded || !Array.isArray(response.payload?.page)) { + throw new Error('Unable to retrieve object authorizations'); + } + return response.payload; + }), + ); + return defer(() => readPage(this.searchByObject(undefined, url, undefined, { elementsPerPage: 100 }, + useCachedVersionIfAvailable, reRequestOnStale, followLink('feature')))).pipe( + expand((page) => { + if (!page.next) { + return EMPTY; + } + const next$ = this.findListByHref(page.next, {}, useCachedVersionIfAvailable, reRequestOnStale, followLink('feature')); + this.addDependency(next$, of(url)); + return readPage(next$); + }), + reduce((authorizations, page) => [...authorizations, ...page.page], [] as Authorization[]), + oneAuthorizationMatchesFeature(featureId), + ); + }), + catchError(() => this.checkAuthorization(featureId, objectUrl, undefined, useCachedVersionIfAvailable, reRequestOnStale)), + ); + } + /** * Perform the actual authorization lookup for a single feature against the REST API. */ From 58d213eb8f5c1aa38f068ce0260292fe949fa66b Mon Sep 17 00:00:00 2001 From: Sascha Szott Date: Mon, 28 Sep 2026 14:41:36 +0200 Subject: [PATCH 18/79] prevent SSR'ing of header login form --- src/app/shared/auth-nav-menu/auth-nav-menu.component.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html index 5f5a89db4db..1b06a457560 100644 --- a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html @@ -21,8 +21,11 @@ role="dialog" aria-modal="true" [attr.aria-label]="'nav.login' | translate"> - + + @defer { + + }
From ae6b6e60ecdcf2cf70099230c953af4c5abad4d7 Mon Sep 17 00:00:00 2001 From: Sascha Szott Date: Tue, 29 Sep 2026 07:54:53 +0200 Subject: [PATCH 19/79] disable SSR and SSR caching for authenticated users --- server.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server.ts b/server.ts index d36fd8c6e00..a69830ff004 100644 --- a/server.ts +++ b/server.ts @@ -228,7 +228,7 @@ export function app() { * The callback function to serve server side angular */ function ngApp(req, res, next) { - if (environment.ssr.enabled && req.method === 'GET' && (req.path === '/' || !isExcludedFromSsr(req.path, environment.ssr.excludePathPatterns))) { + if (environment.ssr.enabled && req.method === 'GET' && !isUserAuthenticated(req) && (req.path === '/' || !isExcludedFromSsr(req.path, environment.ssr.excludePathPatterns))) { // Render the page to user via SSR (server side rendering) serverSideRender(req, res, next); } else { @@ -407,13 +407,19 @@ function anonymousCacheEnabled(): boolean { * Caching is ONLY done for SSR requests. Pages are cached base on their path (e.g. /home or /search?query=test) */ function cacheCheck(req, res, next) { + // Authenticated users are never served via SSR + if (isUserAuthenticated(req)) { + next(); + return; + } + // Cached copy of page (if found) let cachedCopy; // If the bot cache is enabled and this request looks like a bot, check the bot cache for a cached page. if (botCacheEnabled() && isbot(req.get('user-agent'))) { cachedCopy = checkCacheForRequest('bot', botCache, req, res, next); - } else if (anonymousCacheEnabled() && !isUserAuthenticated(req)) { + } else if (anonymousCacheEnabled()) { cachedCopy = checkCacheForRequest('anonymous', anonymousCache, req, res, next); } From 3a45c31e9f1d7429224b06b8547005d6b82fc6a4 Mon Sep 17 00:00:00 2001 From: bram-atmire Date: Fri, 2 Oct 2026 17:04:17 +0200 Subject: [PATCH 20/79] Avoid repeated anonymous authorization feature scans --- .../authorization-data.service.spec.ts | 3 +- .../authorization-data.service.ts | 49 ++++++++++++++----- .../authorization-utils.ts | 12 +++++ 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/app/core/data/feature-authorization/authorization-data.service.spec.ts b/src/app/core/data/feature-authorization/authorization-data.service.spec.ts index 2f89d667047..40ec5947699 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.spec.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.spec.ts @@ -259,8 +259,7 @@ describe('AuthorizationDataService', () => { service.isAuthorized(featureID, 'item-url').subscribe((value) => results.push(value)); service.isAuthorized(FeatureID.CanCreateVersion, 'item-url').subscribe((value) => results.push(value)); expect(results).toEqual([true, false]); - expect(search.calls.count()).toBe(2); - expect(search.calls.argsFor(0)).toEqual(search.calls.argsFor(1)); + expect(search.calls.count()).toBe(1); expect(search).toHaveBeenCalledWith(undefined, 'item-url', undefined, { elementsPerPage: 100 }, true, true, jasmine.anything()); }); diff --git a/src/app/core/data/feature-authorization/authorization-data.service.ts b/src/app/core/data/feature-authorization/authorization-data.service.ts index 437f3e55f65..a2fc697fc60 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.ts @@ -18,6 +18,7 @@ import { filter, map, reduce, + shareReplay, switchMap, take, } from 'rxjs/operators'; @@ -45,7 +46,7 @@ import { RemoteData } from '../remote-data'; import { RequestService } from '../request.service'; import { SiteDataService } from '../site-data.service'; import { AuthorizationSearchParams } from './authorization-search-params'; -import { oneAuthorizationMatchesFeature } from './authorization-utils'; +import { authorizationFeatureIds, oneAuthorizationMatchesFeature } from './authorization-utils'; import { FeatureID } from './feature-id'; /** @@ -59,6 +60,7 @@ export class AuthorizationDataService extends BaseDataService imp protected searchByObjectPath = 'object'; private searchData: SearchDataImpl; + private anonymousFeatureIds = new Map> }>(); constructor( protected requestService: RequestService, @@ -77,6 +79,7 @@ export class AuthorizationDataService extends BaseDataService imp * Set all authorization requests to stale */ invalidateAuthorizationsRequestCache() { + this.anonymousFeatureIds.clear(); this.requestService.setStaleByHrefSubstring(this.linkPath); } @@ -128,18 +131,42 @@ export class AuthorizationDataService extends BaseDataService imp return response.payload; }), ); - return defer(() => readPage(this.searchByObject(undefined, url, undefined, { elementsPerPage: 100 }, - useCachedVersionIfAvailable, reRequestOnStale, followLink('feature')))).pipe( - expand((page) => { - if (!page.next) { - return EMPTY; + const cacheKey = `${url}|${reRequestOnStale}`; + let cached = useCachedVersionIfAvailable ? this.anonymousFeatureIds.get(cacheKey) : undefined; + if (cached && cached.expiresAt <= Date.now()) { + this.anonymousFeatureIds.delete(cacheKey); + cached = undefined; + } + if (!cached) { + const features = defer(() => readPage(this.searchByObject(undefined, url, undefined, { elementsPerPage: 100 }, + useCachedVersionIfAvailable, reRequestOnStale, followLink('feature')))).pipe( + expand((page) => { + if (!page.next) { + return EMPTY; + } + const next$ = this.findListByHref(page.next, {}, useCachedVersionIfAvailable, reRequestOnStale, followLink('feature')); + this.addDependency(next$, of(url)); + return readPage(next$); + }), + reduce((authorizations, page) => [...authorizations, ...page.page], [] as Authorization[]), + authorizationFeatureIds, + shareReplay({ bufferSize: 1, refCount: false }), + ); + // BaseDataService may leave this unset, in which case RequestService uses its + // 15-minute default response lifetime as well. + cached = { expiresAt: Date.now() + (this.responseMsToLive ?? 15 * 60 * 1000), features }; + if (useCachedVersionIfAvailable) { + this.anonymousFeatureIds.set(cacheKey, cached); + } + } + return cached.features.pipe( + map((featureIds) => featureIds.has(featureId.valueOf())), + catchError(() => { + if (this.anonymousFeatureIds.get(cacheKey) === cached) { + this.anonymousFeatureIds.delete(cacheKey); } - const next$ = this.findListByHref(page.next, {}, useCachedVersionIfAvailable, reRequestOnStale, followLink('feature')); - this.addDependency(next$, of(url)); - return readPage(next$); + return this.checkAuthorization(featureId, url, undefined, useCachedVersionIfAvailable, reRequestOnStale); }), - reduce((authorizations, page) => [...authorizations, ...page.page], [] as Authorization[]), - oneAuthorizationMatchesFeature(featureId), ); }), catchError(() => this.checkAuthorization(featureId, objectUrl, undefined, useCachedVersionIfAvailable, reRequestOnStale)), diff --git a/src/app/core/data/feature-authorization/authorization-utils.ts b/src/app/core/data/feature-authorization/authorization-utils.ts index ee91c20058c..53886c5d4a5 100644 --- a/src/app/core/data/feature-authorization/authorization-utils.ts +++ b/src/app/core/data/feature-authorization/authorization-utils.ts @@ -93,3 +93,15 @@ export const oneAuthorizationMatchesFeature = (featureID: FeatureID) => }), map((features: Feature[]) => features.filter((feature: Feature) => feature.id === featureID.valueOf()).length > 0), ); + +/** Resolve the feature links once and retain their IDs for checking multiple features. */ +export const authorizationFeatureIds = (source: Observable): Observable> => + source.pipe( + switchMap((authorizations: Authorization[]) => { + const featureLinks = (authorizations || []) + .filter((authorization: Authorization) => hasValue(authorization.feature)) + .map((authorization: Authorization) => authorization.feature.pipe(getFirstSucceededRemoteDataPayload())); + return featureLinks.length ? observableCombineLatest(featureLinks) : of([]); + }), + map((features: Feature[]) => new Set(features.map((feature) => feature.id))), + ); From 665aa5d3195b7ae0c963d528dc46e6ac835bc324 Mon Sep 17 00:00:00 2001 From: biggdawg320 Date: Fri, 2 Oct 2026 10:24:53 -0700 Subject: [PATCH 21/79] fix(item-versions): hide version history table when only one version is visible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Anonymous users (or any viewer without access to a draft in-progress version) could tell that an item had a draft version under review, because the Version History section was rendered as soon as the version history contained at least one visible version — which is always true for the item currently being viewed. This leaked the existence of hidden version activity, contradicting the REST contract which says this must not be discoverable. Change the two visibility guards in item-versions.component.html to require more than one visible version (via versionsDTO.totalElements) before rendering the title, alert and table, instead of more than zero. The totalElements count already reflects only the versions the current user is authorized to see, so the section now stays hidden whenever there is nothing meaningful to compare against. Co-Authored-By: Claude --- .../versions/item-versions.component.html | 4 +- .../versions/item-versions.component.spec.ts | 48 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/app/item-page/versions/item-versions.component.html b/src/app/item-page/versions/item-versions.component.html index 8df582fd1a8..77a5d6043b8 100644 --- a/src/app/item-page/versions/item-versions.component.html +++ b/src/app/item-page/versions/item-versions.component.html @@ -2,7 +2,7 @@
@if ((versionRD$ | async)?.payload; as itemVersion) {
- @if (versionsDTO.versionDTOs.length > 0 || displayWhenEmpty) { + @if (versionsDTO.totalElements > 1 || displayWhenEmpty) {
@if (displayTitle) {

{{"item.version.history.head" | translate}}

@@ -10,7 +10,7 @@

{{"item.version.history.head" | translate}}

{{ "item.version.history.selected.alert" | translate : {version: itemVersion.version} }} - @if (versionsDTO.versionDTOs.length > 0) { + @if (versionsDTO.totalElements > 1) { { }); }); + describe('when the item has a draft version but only one version is visible to the current user', () => { + const draftVersionHistory = Object.assign(new VersionHistory(), { + id: '2', + draftVersion: true, + }); + const onlyVisibleVersion = Object.assign(new Version(), { + id: '3', + version: 1, + created: new Date(2020, 1, 1), + summary: 'first version', + versionhistory: createSuccessfulRemoteDataObject$(draftVersionHistory), + _links: { + self: { + href: 'version3-url', + }, + }, + }); + const itemWithOnlyOneVisibleVersion = Object.assign(new Item(), { + id: 'item-identifier-3', + uuid: 'item-identifier-3', + handle: '123456789/3', + version: createSuccessfulRemoteDataObject$(onlyVisibleVersion), + _links: { + self: { + href: '/items/item-identifier-3', + }, + }, + }); + onlyVisibleVersion.item = createSuccessfulRemoteDataObject$(itemWithOnlyOneVisibleVersion); + draftVersionHistory.versions = createSuccessfulRemoteDataObject$(createPaginatedList([onlyVisibleVersion])); + + beforeEach(() => { + versionHistoryServiceSpy.getVersions.and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList([onlyVisibleVersion]))); + component.item = itemWithOnlyOneVisibleVersion; + component.ngOnInit(); + fixture.detectChanges(); + }); + + afterEach(() => { + versionHistoryServiceSpy.getVersions.and.returnValue(createSuccessfulRemoteDataObject$(createPaginatedList(versions))); + }); + + it('should not reveal the version history table, as that would disclose the presence of a draft version', () => { + const rows = fixture.debugElement.queryAll(By.css('tbody tr')); + expect(rows.length).toBe(0, 'Version history table should not be shown when only one version is visible to the current user'); + }); + }); + describe('when the user can only delete a version', () => { beforeAll(waitForAsync(() => { const canDelete = (featureID: FeatureID, url: string ) => of(featureID === FeatureID.CanDeleteVersion); From d116488f27a44fd960de7e36e93b01a506a1e2af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Oct 2026 10:49:10 +0000 Subject: [PATCH 22/79] build(deps): bump http-cache-semantics from 4.2.0 to 4.3.0 Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.2.0 to 4.3.0. - [Commits](https://github.com/kornelski/http-cache-semantics/commits) --- updated-dependencies: - dependency-name: http-cache-semantics dependency-version: 4.3.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index edaa71f936b..5dc070ecd45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15737,9 +15737,9 @@ } }, "node_modules/http-cache-semantics": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", - "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.3.0.tgz", + "integrity": "sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA==", "dev": true, "license": "BSD-2-Clause" }, From ffae85c00411ef3d6fc6c06da67516ee663076c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Oct 2026 10:49:25 +0000 Subject: [PATCH 23/79] build(deps): bump hono from 4.13.5 to 4.13.13 Bumps [hono](https://github.com/honojs/hono) from 4.13.5 to 4.13.13. - [Release notes](https://github.com/honojs/hono/releases) - [Commits](https://github.com/honojs/hono/compare/v4.13.5...v4.13.13) --- updated-dependencies: - dependency-name: hono dependency-version: 4.13.13 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index edaa71f936b..193770cf07b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12415,40 +12415,6 @@ "url": "https://opencollective.com/core-js" } }, - "node_modules/core-js-compat/node_modules/browserslist": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", - "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.11.12", - "caniuse-lite": "^1.0.30001809", - "electron-to-chromium": "^1.5.402", - "node-releases": "^2.0.53", - "update-browserslist-db": "^1.3.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -15589,9 +15555,9 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/hono": { - "version": "4.13.5", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.5.tgz", - "integrity": "sha512-O6+/eCYRkzzzy0rPWwKLiGBR1nFuUPZynnwjxN1MBA62NNqbT0wQEzQyK2gSO5yDIDB336sXQleAhOHrzlYyKw==", + "version": "4.13.13", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.13.tgz", + "integrity": "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA==", "dev": true, "license": "MIT", "engines": { From 0766e67b0d2ef272633c75b01e9c5994e4cdb30b Mon Sep 17 00:00:00 2001 From: bram-atmire Date: Mon, 5 Oct 2026 12:32:24 +0200 Subject: [PATCH 24/79] Fix authorization service import lint --- .../data/feature-authorization/authorization-data.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/core/data/feature-authorization/authorization-data.service.ts b/src/app/core/data/feature-authorization/authorization-data.service.ts index a2fc697fc60..ea4c47fe632 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.ts @@ -46,7 +46,10 @@ import { RemoteData } from '../remote-data'; import { RequestService } from '../request.service'; import { SiteDataService } from '../site-data.service'; import { AuthorizationSearchParams } from './authorization-search-params'; -import { authorizationFeatureIds, oneAuthorizationMatchesFeature } from './authorization-utils'; +import { + authorizationFeatureIds, + oneAuthorizationMatchesFeature, +} from './authorization-utils'; import { FeatureID } from './feature-id'; /** From 833726f05e564a8d5b5d08a8bb4ce6dfe1b6d7dd Mon Sep 17 00:00:00 2001 From: bram-atmire Date: Fri, 9 Oct 2026 14:41:36 +0200 Subject: [PATCH 25/79] Stub AuthorizationDataService in FileSectionComponent spec The spec relied on the real AuthorizationDataService being created for FileDownloadLinkComponent. Now that the service depends on AuthService, that construction fails with a missing AuthRequestService provider, which the test runner also reports as a circular dependency. Provide the existing stub, as other component specs do. Assisted-by: Claude Code [claude-opus-5-5] --- .../file-section/file-section.component.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/item-page/simple/field-components/file-section/file-section.component.spec.ts b/src/app/item-page/simple/field-components/file-section/file-section.component.spec.ts index 09069ad1293..920d5f6c5d3 100644 --- a/src/app/item-page/simple/field-components/file-section/file-section.component.spec.ts +++ b/src/app/item-page/simple/field-components/file-section/file-section.component.spec.ts @@ -9,12 +9,14 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { ActivatedRoute } from '@angular/router'; import { APP_CONFIG } from '@dspace/config/app-config.interface'; import { BitstreamDataService } from '@dspace/core/data/bitstream-data.service'; +import { AuthorizationDataService } from '@dspace/core/data/feature-authorization/authorization-data.service'; import { APP_DATA_SERVICES_MAP } from '@dspace/core/data-services-map-type'; import { LocaleService } from '@dspace/core/locale/locale.service'; import { NotificationsService } from '@dspace/core/notification-system/notifications.service'; import { Bitstream } from '@dspace/core/shared/bitstream.model'; import { PageInfo } from '@dspace/core/shared/page-info.model'; import { ActivatedRouteStub } from '@dspace/core/testing/active-router.stub'; +import { AuthorizationDataServiceStub } from '@dspace/core/testing/authorization-service.stub'; import { MockBitstreamFormat1 } from '@dspace/core/testing/item.mock'; import { NotificationsServiceStub } from '@dspace/core/testing/notifications-service.stub'; import { TranslateLoaderMock } from '@dspace/core/testing/translate-loader.mock'; @@ -91,6 +93,7 @@ describe('FileSectionComponent', () => { { provide: APP_DATA_SERVICES_MAP, useValue: {} }, { provide: XSRFService, useValue: {} }, { provide: BitstreamDataService, useValue: bitstreamDataService }, + { provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, { provide: APP_CONFIG, useValue: environment }, { provide: ThemeService, useValue: getMockThemeService() }, From 13e96c9f8b736ae6d68ff63b7f2db666c185fd64 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 07:33:03 +0000 Subject: [PATCH 26/79] build(deps): bump ip-address from 10.5.0 to 10.7.4 Bumps [ip-address](https://github.com/beaugunderson/ip-address) from 10.5.0 to 10.7.4. - [Release notes](https://github.com/beaugunderson/ip-address/releases) - [Commits](https://github.com/beaugunderson/ip-address/compare/v10.5.0...v10.7.4) --- updated-dependencies: - dependency-name: ip-address dependency-version: 10.7.4 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 40 +++------------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32cab92f9c4..f7b57f2a25a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12415,40 +12415,6 @@ "url": "https://opencollective.com/core-js" } }, - "node_modules/core-js-compat/node_modules/browserslist": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", - "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.11.12", - "caniuse-lite": "^1.0.30001809", - "electron-to-chromium": "^1.5.402", - "node-releases": "^2.0.53", - "update-browserslist-db": "^1.3.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -16213,9 +16179,9 @@ } }, "node_modules/ip-address": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.5.0.tgz", - "integrity": "sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==", + "version": "10.7.4", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.4.tgz", + "integrity": "sha512-DWBMKyeM25D70nrIiTkgQth59/G+naKOTep6huF9j+GmeK3DMD60Zvxg5d5qQnz+38AHgou6ean2LECX+lrKDg==", "license": "MIT", "engines": { "node": ">= 12" From 4f459434dc450da613a92caf6b168766c3cdb45c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 07:33:12 +0000 Subject: [PATCH 27/79] build(deps): bump proxy-addr from 2.0.7 to 2.0.8 Bumps [proxy-addr](https://github.com/jshttp/proxy-addr) from 2.0.7 to 2.0.8. - [Release notes](https://github.com/jshttp/proxy-addr/releases) - [Changelog](https://github.com/jshttp/proxy-addr/blob/master/HISTORY.md) - [Commits](https://github.com/jshttp/proxy-addr/compare/v2.0.7...v2.0.8) --- updated-dependencies: - dependency-name: proxy-addr dependency-version: 2.0.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32cab92f9c4..ccc6473c598 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12415,40 +12415,6 @@ "url": "https://opencollective.com/core-js" } }, - "node_modules/core-js-compat/node_modules/browserslist": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", - "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.11.12", - "caniuse-lite": "^1.0.30001809", - "electron-to-chromium": "^1.5.402", - "node-releases": "^2.0.53", - "update-browserslist-db": "^1.3.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, "node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -21526,15 +21492,20 @@ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", + "license": "MIT", "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" }, "engines": { "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/prr": { From 0c5ea1a2c1e64b0373a4c4a69f37ea72e9e9bbf4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 07:33:44 +0000 Subject: [PATCH 28/79] build(deps): bump uuid from 14.0.2 to 14.0.3 Bumps [uuid](https://github.com/uuidjs/uuid) from 14.0.2 to 14.0.3. - [Release notes](https://github.com/uuidjs/uuid/releases) - [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md) - [Commits](https://github.com/uuidjs/uuid/compare/v14.0.2...v14.0.3) --- updated-dependencies: - dependency-name: uuid dependency-version: 14.0.3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32cab92f9c4..e17cd716b63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -79,7 +79,7 @@ "pem": "1.14.8", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.0", - "uuid": "^14.0.2", + "uuid": "^14.0.3", "xhr2": "^0.2.1", "zone.js": "~0.15.1" }, @@ -24814,9 +24814,9 @@ } }, "node_modules/uuid": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.2.tgz", - "integrity": "sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ==", + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.3.tgz", + "integrity": "sha512-Sc5u1VVln93y1Xnz4R+CunOZc7R9LUcTmhj7Rc7Eg3HVcf7rVn2FOoa812fe0W8p3jD7xeoGSYbfqCGGH2B6xw==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" diff --git a/package.json b/package.json index c301eb12704..3cb1dc8248a 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "pem": "1.14.8", "reflect-metadata": "^0.2.2", "rxjs": "^7.8.0", - "uuid": "^14.0.2", + "uuid": "^14.0.3", "xhr2": "^0.2.1", "zone.js": "~0.15.1" }, From 140e56a259b84fecb2c1ee907cd56cb0cdda3db2 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 13 Oct 2026 13:36:37 +0200 Subject: [PATCH 29/79] Update cache ssr responses --- server.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/server.ts b/server.ts index 454db8d3c2d..c155943fe67 100644 --- a/server.ts +++ b/server.ts @@ -510,8 +510,8 @@ function saveToCache(req, page: any) { const key = getCacheKey(req); // Avoid caching "/reload/[random]" paths (these are hard refreshes after logout) if (key.startsWith('/reload')) { return; } - // Avoid caching not successful responses (status code different from 2XX status) - if (hasNotSucceeded(req.res.statusCode)) { return; } + // Only cache a fully rendered 200 response. + if (req.res.statusCode !== 200) { return; } // Retrieve response headers to save, if any const headers = retrieveHeaders(req.res); @@ -530,15 +530,6 @@ function saveToCache(req, page: any) { } } -/** - * Check if status code is different from 2XX - * @param statusCode - */ -function hasNotSucceeded(statusCode) { - const rgx = new RegExp(/^20+/); - return !rgx.test(statusCode); -} - function retrieveHeaders(response) { const headers = Object.create({}); if (Array.isArray(environment.cache.serverSide.headers) && environment.cache.serverSide.headers.length > 0) { From 5ba55010ca015ebfab058a2720479bbd809d2bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Thu, 9 Apr 2026 13:40:08 +0200 Subject: [PATCH 30/79] Added new config settings. --- config/config.example.yml | 4 ++++ src/config/default-app-config.ts | 2 ++ src/config/homepage-config.interface.ts | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/config/config.example.yml b/config/config.example.yml index 1cd2d414d31..072bb02a7e6 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -406,6 +406,10 @@ homePage: pageSize: 5 # Enable or disable the Discover filters on the homepage showDiscoverFilters: false + # Disable if you don't want users to edit the homeNews section on your home-page. + editHomeNews: true + # Disable if you don't want users to edit the home header. + editHomeHeader: true # Item Config item: diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index fd703d4d024..a98f939a375 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -375,6 +375,8 @@ export class DefaultAppConfig implements AppConfig { pageSize: 5, }, showDiscoverFilters: false, + editHomeNews: true, + editHomeHeader: true, }; // Item Config diff --git a/src/config/homepage-config.interface.ts b/src/config/homepage-config.interface.ts index 47d75e60743..2dd56af7351 100644 --- a/src/config/homepage-config.interface.ts +++ b/src/config/homepage-config.interface.ts @@ -28,4 +28,14 @@ export interface HomeConfig extends Config { * Enable or disable the Discover filters on the homepage */ showDiscoverFilters: boolean; + + /** + * Disable if you don't want users to edit the homeNews section on your home-page. + */ + editHomeNews: boolean; + + /** + * Disable if you don't want users to edit the home header. + */ + editHomeHeader: boolean; } From 4a0a5a3014c083a434e48028904c4d7503f90c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Thu, 9 Apr 2026 14:00:09 +0200 Subject: [PATCH 31/79] Added config based conditions to home-news and home-header --- .../home-news/home-news.component.ts | 26 ++++++++++++------- src/app/home-page/home-page.component.ts | 17 ++++++------ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/app/home-page/home-news/home-news.component.ts b/src/app/home-page/home-news/home-news.component.ts index d6f7eb39995..a6fe0ebb0f9 100644 --- a/src/app/home-page/home-news/home-news.component.ts +++ b/src/app/home-page/home-news/home-news.component.ts @@ -1,9 +1,14 @@ import { AsyncPipe } from '@angular/common'; import { Component, + Inject, OnInit, } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; +import { + APP_CONFIG, + AppConfig, +} from '@dspace/config/app-config.interface'; import { LocaleService } from '@dspace/core/locale/locale.service'; import { Site } from '@dspace/core/shared/site.model'; import { @@ -32,20 +37,23 @@ export class HomeNewsComponent implements OnInit { homeNewsMetadataValue$: Observable; constructor( + @Inject(APP_CONFIG) protected appConfig: AppConfig, protected route: ActivatedRoute, private locale: LocaleService, ) {} ngOnInit() { - this.homeNewsMetadataValue$ = combineLatest({ - site$: this.route.data.pipe( - map((data) => data.site as Site), - ), - language$: this.locale.getCurrentLanguageCode(), - }).pipe( - take(1), - map(({ site$, language$ }) => site$?.firstMetadataValue('dspace.cms.home-news', { language: language$ })), - ); + if (this.appConfig.homePage.editHomeNews) { + this.homeNewsMetadataValue$ = combineLatest({ + site$: this.route.data.pipe( + map((data) => data.site as Site), + ), + language$: this.locale.getCurrentLanguageCode(), + }).pipe( + take(1), + map(({ site$, language$ }) => site$?.firstMetadataValue('dspace.cms.home-news', { language: language$ })), + ); + } } } diff --git a/src/app/home-page/home-page.component.ts b/src/app/home-page/home-page.component.ts index cf75770b9e8..3b1e4e40065 100644 --- a/src/app/home-page/home-page.component.ts +++ b/src/app/home-page/home-page.component.ts @@ -71,14 +71,15 @@ export class HomePageComponent implements OnInit { this.site$ = this.route.data.pipe( map((data) => data.site as Site), ); - - this.homeHeaderMetadataValue$ = combineLatest({ - site: this.site$, - language: this.locale.getCurrentLanguageCode(), - }).pipe( - take(1), - map(({ site, language }) => site?.firstMetadataValue('dspace.cms.home-header', { language })), - ); + if (this.appConfig.homePage.editHomeHeader) { + this.homeHeaderMetadataValue$ = combineLatest({ + site: this.site$, + language: this.locale.getCurrentLanguageCode(), + }).pipe( + take(1), + map(({site, language}) => site?.firstMetadataValue('dspace.cms.home-header', {language})), + ); + } } } From 056d43360b33c344928ca837b034e4d2ffcc3461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Thu, 9 Apr 2026 14:22:32 +0200 Subject: [PATCH 32/79] Added missing test-environment defaults. --- src/environments/environment.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/environments/environment.test.ts b/src/environments/environment.test.ts index bfe2b702f3c..70152834502 100644 --- a/src/environments/environment.test.ts +++ b/src/environments/environment.test.ts @@ -276,6 +276,8 @@ export const environment: BuildConfig = { pageSize: 5, }, showDiscoverFilters: false, + editHomeNews: true, + editHomeHeader: true, }, item: { edit: { From fab0d321e8048b4bd20af143596daf9b1cf4d8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Thu, 9 Apr 2026 14:23:57 +0200 Subject: [PATCH 33/79] Removing not-displayed cms metadata from dropdown and hide edit-cms-metadata section if none can be displayed. --- .../admin-edit-cms-metadata.component.ts | 6 ++++++ .../shared/menu/providers/edit-cms-metadata.menu.ts | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app/admin/admin-edit-cms-metadata/admin-edit-cms-metadata.component.ts b/src/app/admin/admin-edit-cms-metadata/admin-edit-cms-metadata.component.ts index a3344dbdb88..37406fd3f59 100644 --- a/src/app/admin/admin-edit-cms-metadata/admin-edit-cms-metadata.component.ts +++ b/src/app/admin/admin-edit-cms-metadata/admin-edit-cms-metadata.component.ts @@ -82,6 +82,12 @@ export class AdminEditCmsMetadataComponent implements OnInit { if (md === 'dspace.cms.footer' && !environment.homePage.showTopFooter) { return; } + if (md === 'dspace.cms.home-header' && !environment.homePage.editHomeHeader) { + return; + } + if (md === 'dspace.cms.home-news' && !environment.homePage.editHomeNews) { + return; + } this.metadataList.push(md); }); this.refreshSiteWithAllLanguages(); diff --git a/src/app/shared/menu/providers/edit-cms-metadata.menu.ts b/src/app/shared/menu/providers/edit-cms-metadata.menu.ts index 0296ecd4b19..83e3ab51c07 100644 --- a/src/app/shared/menu/providers/edit-cms-metadata.menu.ts +++ b/src/app/shared/menu/providers/edit-cms-metadata.menu.ts @@ -6,7 +6,14 @@ * http://www.dspace.org/license/ */ -import { Injectable } from '@angular/core'; +import { + Inject, + Injectable, +} from '@angular/core'; +import { + APP_CONFIG, + AppConfig, +} from '@dspace/config/app-config.interface'; import { AuthorizationDataService } from '@dspace/core/data/feature-authorization/authorization-data.service'; import { FeatureID } from '@dspace/core/data/feature-authorization/feature-id'; import { @@ -28,6 +35,7 @@ import { export class EditCMSMetadataMenuProvider extends AbstractMenuProvider { constructor( protected authorizationService: AuthorizationDataService, + @Inject(APP_CONFIG) protected appConfig: AppConfig, ) { super(); } @@ -39,7 +47,7 @@ export class EditCMSMetadataMenuProvider extends AbstractMenuProvider { map(([isSiteAdmin]) => { return [ { - visible: isSiteAdmin, + visible: isSiteAdmin && (this.appConfig.homePage.editHomeHeader || this.appConfig.homePage.editHomeHeader || this.appConfig.homePage.showTopFooter), model: { type: MenuItemType.LINK, text: 'menu.section.edit-cms-metadata', From 9e100b8d457072e09212be197d040f8ed013940e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Thu, 9 Apr 2026 14:53:02 +0200 Subject: [PATCH 34/79] Fixed linter in home-page.component.ts --- src/app/home-page/home-page.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/home-page/home-page.component.ts b/src/app/home-page/home-page.component.ts index 3b1e4e40065..dad6888dfb1 100644 --- a/src/app/home-page/home-page.component.ts +++ b/src/app/home-page/home-page.component.ts @@ -77,7 +77,7 @@ export class HomePageComponent implements OnInit { language: this.locale.getCurrentLanguageCode(), }).pipe( take(1), - map(({site, language}) => site?.firstMetadataValue('dspace.cms.home-header', {language})), + map(({ site, language }) => site?.firstMetadataValue('dspace.cms.home-header', { language })), ); } } From c468aefcaf10e10b4bff4cd8d04697ef09ceef5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eike=20Martin=20L=C3=B6hden?= Date: Tue, 13 Oct 2026 15:35:59 +0200 Subject: [PATCH 35/79] Corrected typo in edit-cms-metadata.menu.ts --- src/app/shared/menu/providers/edit-cms-metadata.menu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/menu/providers/edit-cms-metadata.menu.ts b/src/app/shared/menu/providers/edit-cms-metadata.menu.ts index 83e3ab51c07..50d81aaeb1b 100644 --- a/src/app/shared/menu/providers/edit-cms-metadata.menu.ts +++ b/src/app/shared/menu/providers/edit-cms-metadata.menu.ts @@ -47,7 +47,7 @@ export class EditCMSMetadataMenuProvider extends AbstractMenuProvider { map(([isSiteAdmin]) => { return [ { - visible: isSiteAdmin && (this.appConfig.homePage.editHomeHeader || this.appConfig.homePage.editHomeHeader || this.appConfig.homePage.showTopFooter), + visible: isSiteAdmin && (this.appConfig.homePage.editHomeHeader || this.appConfig.homePage.editHomeNews || this.appConfig.homePage.showTopFooter), model: { type: MenuItemType.LINK, text: 'menu.section.edit-cms-metadata', From 3329984f5066b5b9ff38861e683a4a9f9aad89d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2026 22:33:57 +0000 Subject: [PATCH 36/79] build(deps): bump shell-quote from 1.10.0 to 1.12.0 Bumps [shell-quote](https://github.com/ljharb/shell-quote) from 1.10.0 to 1.12.0. - [Changelog](https://github.com/ljharb/shell-quote/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/shell-quote/compare/v1.10.0...v1.12.0) --- updated-dependencies: - dependency-name: shell-quote dependency-version: 1.12.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32cab92f9c4..cbf41f2b6c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23260,9 +23260,9 @@ } }, "node_modules/shell-quote": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.10.0.tgz", - "integrity": "sha512-w1aiOKwKuRgtwAReIIj89puqg+I7GvX4IbLrvmhXbzQsj1+Zwi4VO3+fa6ZF91TWSjIxoEkKnMeHcLEODK5ZXA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.12.0.tgz", + "integrity": "sha512-PcByqNyT/38F2kDNi006HAMRJaULuBzq/FOsw3qdZvX/GA9W/jamDaRskgHjubHiftXK5sIFxLNkvrXUwcof6Q==", "dev": true, "license": "MIT", "engines": { From 5dd6ed6774601034fc9eab07afd973bf1af7037e Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Fri, 16 Oct 2026 00:06:23 +0200 Subject: [PATCH 37/79] Fix COAR Notify not rendering logs (#4867) * 134770: Fixed COAR notify not rendering inbound/outbounds logs Also fixed an issue where an error is logged when no dynamic component is found * 134770: Aligned styling from Add LDN service form with other submission forms --- .../ldn-service-form.component.html | 375 +++++++++--------- .../ldn-service-form.component.scss | 130 +----- .../ldn-service-form.component.ts | 2 + .../admin-notify-detail-modal.component.html | 2 +- .../admin-notify-search-result.component.html | 2 +- .../core/cache/builders/build-decorators.ts | 2 +- .../models/admin-notify-message.model.ts | 19 - .../abstract-component-loader.component.ts | 7 +- src/assets/i18n/ar.json5 | 6 +- src/assets/i18n/bn.json5 | 6 +- src/assets/i18n/ca.json5 | 6 +- src/assets/i18n/cs.json5 | 6 +- src/assets/i18n/de.json5 | 4 +- src/assets/i18n/el.json5 | 6 +- src/assets/i18n/en.json5 | 6 +- src/assets/i18n/es.json5 | 6 +- src/assets/i18n/fa.json5 | 6 +- src/assets/i18n/fi.json5 | 6 +- src/assets/i18n/fr.json5 | 6 +- src/assets/i18n/gd.json5 | 6 +- src/assets/i18n/gu.json5 | 6 +- src/assets/i18n/hi.json5 | 6 +- src/assets/i18n/hu.json5 | 6 +- src/assets/i18n/it.json5 | 6 +- src/assets/i18n/ja.json5 | 6 +- src/assets/i18n/kk.json5 | 6 +- src/assets/i18n/lv.json5 | 6 +- src/assets/i18n/ml.json5 | 6 +- src/assets/i18n/mr.json5 | 6 +- src/assets/i18n/nl.json5 | 6 +- src/assets/i18n/od.json5 | 6 +- src/assets/i18n/pl.json5 | 6 +- src/assets/i18n/pt-BR.json5 | 6 +- src/assets/i18n/pt-PT.json5 | 6 +- src/assets/i18n/ru.json5 | 6 +- src/assets/i18n/sr-cyr.json5 | 8 +- src/assets/i18n/sr-lat.json5 | 8 +- src/assets/i18n/sv.json5 | 8 +- src/assets/i18n/sw.json5 | 8 +- src/assets/i18n/ta.json5 | 6 +- src/assets/i18n/te.json5 | 6 +- src/assets/i18n/tr.json5 | 8 +- src/assets/i18n/uk.json5 | 8 +- src/assets/i18n/vi.json5 | 8 +- src/assets/i18n/zh-TW.json5 | 4 +- 45 files changed, 317 insertions(+), 454 deletions(-) diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html index 92d015b25e3..41ee00349b0 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html @@ -1,162 +1,165 @@
-
+

{{ isNewService ? ('ldn-create-service.title' | translate) : ('ldn-edit-registered-service.title' | translate) }}

-
- - @if (!isNewService) { -
- -
- -
-
+
+ + @if (!isNewService) { +
+ +
-
+ }
- } +
-
- - +
+ + @if (formModel.get('name').invalid && formModel.get('name').touched) { -
+ {{ 'ldn-new-service.form.error.name' | translate }} -
+ }
-
- +
+ + class="form-control" formControlName="description" id="description" name="description">
-
+
-
-
- - +
+
+ + @if (formModel.get('url').invalid && formModel.get('url').touched) { -
+ {{ 'ldn-new-service.form.error.url' | translate }} -
+ }
-
- - +
+ + @if (formModel.get('score').invalid && formModel.get('score').touched) { -
+ {{ 'ldn-new-service.form.error.score' | translate }} -
+ }
-
- -
- - +
+ +
+
+ +
+
+ +
@if ((formModel.get('lowerIp').invalid && formModel.get('lowerIp').touched) || (formModel.get('upperIp').invalid && formModel.get('upperIp').touched)) { -
+ {{ 'ldn-new-service.form.error.ipRange' | translate }} -
+ + } @else { + + {{ 'ldn-new-service.form.hint.ipRange' | translate }} + } -
- {{ 'ldn-new-service.form.hint.ipRange' | translate }} -
-
- - +
+ + @if (formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched) {
@if (formModel.get('ldnUrl').errors['required']) { -
+ {{ 'ldn-new-service.form.error.ldnurl' | translate }} -
+ } @if (formModel.get('ldnUrl').errors['ldnUrlAlreadyAssociated']) { -
+ {{ 'ldn-new-service.form.error.ldnurl.ldnUrlAlreadyAssociated' | translate }} -
+ }
}
-
- +
+
- -
-
+
+ +
-
+ {{ 'ldn-service-usesActorEmailId-description' | translate }} -
+
@if (areControlsInitialized) { -
+
- +
@if (formModel.get('notifyServiceInboundPatterns')['controls'][0]?.value?.pattern) {
- +
- +
}
@@ -175,11 +178,11 @@

{{ isNewService ? ('ldn-create-service.title' | translat
+ id="additionalInboundPattern{{i}}" + ngbDropdown placement="top-start">