From f7ba6aaefee260ded41ec55d456ff50437a91b13 Mon Sep 17 00:00:00 2001 From: Steve McConnel Date: Mon, 29 Sep 2025 16:09:52 -0600 Subject: [PATCH] Show specific reasons for hiding provided by harvester (BL-15289) --- .../ArtifactAndChoice.stories.tsx | 1 + .../BookDetail/DownloadsGroup.stories.tsx | 1 + src/components/BookDetail/StaffControlsBox.tsx | 1 + src/model/ArtifactVisibilitySettings.ts | 17 ++++++++++++----- .../BloomLibrary.org/Code Strings.json | 8 ++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/BookDetail/ArtifactVisibilityPanel/ArtifactAndChoice.stories.tsx b/src/components/BookDetail/ArtifactVisibilityPanel/ArtifactAndChoice.stories.tsx index 58b215de..0dc4554d 100644 --- a/src/components/BookDetail/ArtifactVisibilityPanel/ArtifactAndChoice.stories.tsx +++ b/src/components/BookDetail/ArtifactVisibilityPanel/ArtifactAndChoice.stories.tsx @@ -46,6 +46,7 @@ export const ArtifactAndChoiceStory: Story = { visibilitySettings={ new ArtifactVisibilitySettings( harvester, + undefined, librarian, user ) diff --git a/src/components/BookDetail/DownloadsGroup.stories.tsx b/src/components/BookDetail/DownloadsGroup.stories.tsx index 98512ef4..d5c9855f 100644 --- a/src/components/BookDetail/DownloadsGroup.stories.tsx +++ b/src/components/BookDetail/DownloadsGroup.stories.tsx @@ -38,6 +38,7 @@ export const Default = (args: { ); testBook.artifactsToOfferToUsers.epub = new ArtifactVisibilitySettings( true, + undefined, true, true, true diff --git a/src/components/BookDetail/StaffControlsBox.tsx b/src/components/BookDetail/StaffControlsBox.tsx index 5abcc675..2651f1ad 100644 --- a/src/components/BookDetail/StaffControlsBox.tsx +++ b/src/components/BookDetail/StaffControlsBox.tsx @@ -42,6 +42,7 @@ export const StaffControlsBox: React.FunctionComponent<{ decision: a.decision, hasHarvesterDecided: a.hasHarvesterDecided(), isHarvesterHide: a.isHarvesterHide(), + harvesterReasonToHideId: a.harvesterReasonToHideId, hasLibrarianDecided: a.hasLibrarianDecided(), isLibrarianHide: a.isLibrarianHide(), getDecisionSansUser: a.getDecisionSansUser(), diff --git a/src/model/ArtifactVisibilitySettings.ts b/src/model/ArtifactVisibilitySettings.ts index a216e473..4d6c98ac 100644 --- a/src/model/ArtifactVisibilitySettings.ts +++ b/src/model/ArtifactVisibilitySettings.ts @@ -5,18 +5,21 @@ import { IntlShape } from "react-intl"; // This is related to the "show" column on book in ParseServer export class ArtifactVisibilitySettings { public harvester: boolean | undefined; + public harvesterReasonToHideId: string | undefined; public librarian: boolean | undefined; public user: boolean | undefined; public exists: boolean | undefined; constructor( harvester?: boolean | undefined, + harvesterReasonToHideId?: string | undefined, librarian?: boolean | undefined, user?: boolean | undefined, exists?: boolean | undefined ) { makeObservable(this, { harvester: observable, + harvesterReasonToHideId: observable, librarian: observable, user: observable, exists: observable, @@ -24,6 +27,7 @@ export class ArtifactVisibilitySettings { }); this.harvester = harvester; + this.harvesterReasonToHideId = harvesterReasonToHideId; this.librarian = librarian; this.user = user; this.exists = exists; @@ -41,9 +45,9 @@ export class ArtifactVisibilitySettings { return this.harvester !== undefined; }; - public isHarvesterHide = (): boolean => { + public isHarvesterHide(): boolean { return this.harvester === false; - }; + } public hasLibrarianDecided = (): boolean => { return this.librarian !== undefined; @@ -102,9 +106,12 @@ export class ArtifactVisibilitySettings { })) || (this.isHarvesterHide() && l10n.formatMessage({ - id: "book.artifacts.visibility.scaling", - defaultMessage: - "Our system was not confident about scaling the book to this format.", + id: this.harvesterReasonToHideId + ? this.harvesterReasonToHideId + : "book.artifacts.visibility.scaling", + defaultMessage: this.harvesterReasonToHideId + ? this.harvesterReasonToHideId + : "Our system was not confident about scaling the book to this format.", })) || (this.doesNotExist() && l10n.formatMessage({ diff --git a/src/translations/BloomLibrary.org/Code Strings.json b/src/translations/BloomLibrary.org/Code Strings.json index dd9207f6..65af714b 100644 --- a/src/translations/BloomLibrary.org/Code Strings.json +++ b/src/translations/BloomLibrary.org/Code Strings.json @@ -388,6 +388,14 @@ "description": "", "message": "Our system was not confident about scaling the book to this format." }, + "harvest-reason-copyright-license-restriction": { + "description": "", + "message": "The book's copyright license restricts distribution." + }, + "harvest-reason-epub-deemed-unsuitable": { + "description": "", + "message": "The EPUB format was deemed unsuitable due to the complexity of some page layouts." + }, "book.artifacts.doesnotexist": { "description": "", "message": "BloomLibrary does not have the book in this format."