Fix being able to access the changelog of deleted items.

master
Tom Hacohen 4 years ago
parent 1b788acf83
commit 6ea3b880f9

@ -134,6 +134,21 @@ export default function CalendarsMain() {
history={history}
/>
</Route>
<Route
path={routeResolver.getRoute("pim.events._id.log")}
render={({ match }) => {
// We have this path outside because we don't want the item existing check
const [colUid, itemUid] = match.params.itemUid.split("|");
const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!;
if (!cachedCollection) {
return (<PageNotFound />);
}
return (
<ItemChangeHistory collection={cachedCollection} itemUid={itemUid} />
);
}}
/>
<Route
path={routeResolver.getRoute("pim.events._id")}
render={({ match }) => {
@ -179,19 +194,6 @@ export default function CalendarsMain() {
duplicate
/>
</Route>
<Route
path={routeResolver.getRoute("pim.events._id.log")}
render={() => {
const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!;
if (!cachedCollection) {
return (<PageNotFound />);
}
return (
<ItemChangeHistory collection={cachedCollection} itemUid={itemUid} />
);
}}
/>
<Route
path={routeResolver.getRoute("pim.events._id")}
exact

@ -118,6 +118,21 @@ export default function ContactsMain() {
history={history}
/>
</Route>
<Route
path={routeResolver.getRoute("pim.contacts._id.log")}
render={({ match }) => {
// We have this path outside because we don't want the item existing check
const [colUid, itemUid] = match.params.itemUid.split("|");
const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!;
if (!cachedCollection) {
return (<PageNotFound />);
}
return (
<ItemChangeHistory collection={cachedCollection} itemUid={itemUid} />
);
}}
/>
<Route
path={routeResolver.getRoute("pim.contacts._id")}
render={({ match }) => {
@ -147,19 +162,6 @@ export default function ContactsMain() {
history={history}
/>
</Route>
<Route
path={routeResolver.getRoute("pim.contacts._id.log")}
render={() => {
const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!;
if (!cachedCollection) {
return (<PageNotFound />);
}
return (
<ItemChangeHistory collection={cachedCollection} itemUid={itemUid} />
);
}}
/>
<Route
path={routeResolver.getRoute("pim.contacts._id")}
exact

@ -16,6 +16,7 @@ import LoadingIndicator from "../widgets/LoadingIndicator";
import GenericChangeHistory from "../components/GenericChangeHistory";
import { useItems } from "../etebase-helpers";
import { CachedCollection } from "./helpers";
import PageNotFound from "../PageNotFound";
export interface CachedItem {
item: Etebase.Item;
@ -68,6 +69,10 @@ export default function ItemChangeHistory(props: PropsType) {
}
}, [etebase, collection, item]);
if (!item) {
return (<PageNotFound />);
}
if (!entries) {
return (
<LoadingIndicator />

@ -120,6 +120,21 @@ export default function TasksMain() {
history={history}
/>
</Route>
<Route
path={routeResolver.getRoute("pim.tasks._id.log")}
render={({ match }) => {
// We have this path outside because we don't want the item existing check
const [colUid, itemUid] = match.params.itemUid.split("|");
const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!;
if (!cachedCollection) {
return (<PageNotFound />);
}
return (
<ItemChangeHistory collection={cachedCollection} itemUid={itemUid} />
);
}}
/>
<Route
path={routeResolver.getRoute("pim.tasks._id")}
render={({ match }) => {
@ -149,19 +164,6 @@ export default function TasksMain() {
history={history}
/>
</Route>
<Route
path={routeResolver.getRoute("pim.tasks._id.log")}
render={() => {
const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!;
if (!cachedCollection) {
return (<PageNotFound />);
}
return (
<ItemChangeHistory collection={cachedCollection} itemUid={itemUid} />
);
}}
/>
<Route
path={routeResolver.getRoute("pim.tasks._id")}
exact

Loading…
Cancel
Save