Fix #246 Metadata is not hidden when "Show metadata" is disabled

This commit is contained in:
Alan Grainger
2026-06-09 09:30:36 +12:00
parent b40383e72e
commit e436fd36fb
4 changed files with 29 additions and 12 deletions
+5
View File
@@ -77,6 +77,11 @@ function groupItemsByMonth (): GroupSpec[] {
}
g.indices.push(i)
}
// When every item is undated (typically because the share's "Show metadata"
// toggle stripped dates upstream), drop the lone "Undated" header
if (map.size === 1 && map.has('undated')) {
map.get('undated')!.label = null
}
return Array.from(map.values())
}
+8 -4
View File
@@ -37,9 +37,13 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
// Metadata display flags. Read once here and forwarded to the client via
// `metadataConfig` in the init JSON.
const descriptionInCaption = !!getConfigOption('ipp.showMetadata.description.caption', false)
const descriptionInSidebar = !!getConfigOption('ipp.showMetadata.description.sidebar', false)
const sidebarHasContent = descriptionInSidebar || metadataGroupActive('exif') || metadataGroupActive('location')
// The share owner's "Show metadata" toggle in Immich is a kill-switch over
// the operator's own config: when explicitly `false`, no EXIF / location /
// description fields are surfaced, regardless of `ipp.showMetadata.*`
const shareMetadataAllowed = share.showMetadata !== false
const descriptionInCaption = shareMetadataAllowed && !!getConfigOption('ipp.showMetadata.description.caption', false)
const descriptionInSidebar = shareMetadataAllowed && !!getConfigOption('ipp.showMetadata.description.sidebar', false)
const sidebarHasContent = shareMetadataAllowed && (descriptionInSidebar || metadataGroupActive('exif') || metadataGroupActive('location'))
// Build structured items in parallel
const items: GalleryItem[] = await Promise.all(share.assets.map(async (asset): Promise<GalleryItem> => {
@@ -97,7 +101,7 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
height,
thumbhash: asset.thumbhash,
fileCreatedAt: asset.fileCreatedAt,
exif: pickExif(asset)
exif: shareMetadataAllowed ? pickExif(asset) : undefined
}
}))
+5
View File
@@ -68,6 +68,11 @@ export interface SharedLink {
description?: string;
assets: Asset[];
allowDownload?: boolean;
// Per-share "Show metadata" toggle from Immich. When `false`, the share owner
// has asked that no EXIF / location / description / filename metadata be
// surfaced to viewers. We treat this as a kill-switch over the operator's
// own `ipp.showMetadata.*` config: see `gallery/builder.ts`.
showMetadata?: boolean;
password?: string;
album?: {
id: string;