Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const ArtifactAndChoiceStory: Story = {
visibilitySettings={
new ArtifactVisibilitySettings(
harvester,
undefined,
librarian,
user
)
Expand Down
1 change: 1 addition & 0 deletions src/components/BookDetail/DownloadsGroup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const Default = (args: {
);
testBook.artifactsToOfferToUsers.epub = new ArtifactVisibilitySettings(
true,
undefined,
true,
true,
true
Expand Down
1 change: 1 addition & 0 deletions src/components/BookDetail/StaffControlsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
17 changes: 12 additions & 5 deletions src/model/ArtifactVisibilitySettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@ 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,
decision: computed,
});

this.harvester = harvester;
this.harvesterReasonToHideId = harvesterReasonToHideId;
this.librarian = librarian;
this.user = user;
this.exists = exists;
Expand All @@ -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;
Expand Down Expand Up @@ -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({
Expand Down
8 changes: 8 additions & 0 deletions src/translations/BloomLibrary.org/Code Strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down