Skip to content

Commit

Permalink
Remove max_cache_age parameter (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen authored Nov 22, 2024
1 parent 1753953 commit b6ad96f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/components/CatalogPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ export default class CatalogPage extends React.Component<CatalogPageProps, {}> {
}

expandCollectionUrl(url: string): string {
return url
? `${document.location.origin}/${url}${
url.includes("?") ? "&" : "?"
}max_cache_age=0`
: url;
return url ? `${document.location.origin}/${url}` : url;
}

expandBookUrl(url: string): string {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class Header extends React.Component<HeaderProps, HeaderState> {

// Links that will be rendered in a NavItem Bootstrap component.
const libraryNavItems = [
{ label: "Catalog", href: "%2Fgroups?max_cache_age=0" },
{ label: "Catalog", href: "%2Fgroups" },
{ label: "Hidden Books", href: "%2Fadmin%2Fsuppressed" },
];
// Other links that will be rendered in a Link router component and are library specific.
Expand Down Expand Up @@ -231,7 +231,7 @@ export class Header extends React.Component<HeaderProps, HeaderState> {
let library = this.libraryRef.current.getValue();
if (library) {
this.context.router.push(
"/admin/web/collection/" + library + "%2Fgroups?max_cache_age=0"
"/admin/web/collection/" + library + "%2Fgroups"
);
this.forceUpdate();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/__tests__/CatalogPage-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("CatalogPage", () => {
it("renders OPDSCatalog", () => {
const catalog = wrapper.find(OPDSCatalog);
expect(catalog.prop("collectionUrl")).to.equal(
host + "/library/collectionurl?max_cache_age=0"
host + "/library/collectionurl"
);
expect(catalog.prop("bookUrl")).to.equal(host + "/library/works/bookurl");
expect(catalog.prop("BookDetailsContainer").name).to.equal(
Expand All @@ -45,7 +45,7 @@ describe("CatalogPage", () => {
it("handles the case in which the URL already contains a query string", () => {
const queryUrl = "library/collectionurl?samplequery=test";
expect(wrapper.instance().expandCollectionUrl(queryUrl)).to.equal(
host + "/library/collectionurl?samplequery=test&max_cache_age=0"
host + "/library/collectionurl?samplequery=test"
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/Header-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe("Header", () => {

expect(fullContext.router.push.callCount).to.equal(1);
expect(fullContext.router.push.args[0][0]).to.equal(
"/admin/web/collection/bpl%2Fgroups?max_cache_age=0"
"/admin/web/collection/bpl%2Fgroups"
);
});

Expand Down

0 comments on commit b6ad96f

Please sign in to comment.