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} history={history}
/> />
</Route> </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 <Route
path={routeResolver.getRoute("pim.events._id")} path={routeResolver.getRoute("pim.events._id")}
render={({ match }) => { render={({ match }) => {
@ -179,19 +194,6 @@ export default function CalendarsMain() {
duplicate duplicate
/> />
</Route> </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 <Route
path={routeResolver.getRoute("pim.events._id")} path={routeResolver.getRoute("pim.events._id")}
exact exact

@ -118,6 +118,21 @@ export default function ContactsMain() {
history={history} history={history}
/> />
</Route> </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 <Route
path={routeResolver.getRoute("pim.contacts._id")} path={routeResolver.getRoute("pim.contacts._id")}
render={({ match }) => { render={({ match }) => {
@ -147,19 +162,6 @@ export default function ContactsMain() {
history={history} history={history}
/> />
</Route> </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 <Route
path={routeResolver.getRoute("pim.contacts._id")} path={routeResolver.getRoute("pim.contacts._id")}
exact exact

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

@ -120,6 +120,21 @@ export default function TasksMain() {
history={history} history={history}
/> />
</Route> </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 <Route
path={routeResolver.getRoute("pim.tasks._id")} path={routeResolver.getRoute("pim.tasks._id")}
render={({ match }) => { render={({ match }) => {
@ -149,19 +164,6 @@ export default function TasksMain() {
history={history} history={history}
/> />
</Route> </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 <Route
path={routeResolver.getRoute("pim.tasks._id")} path={routeResolver.getRoute("pim.tasks._id")}
exact exact

Loading…
Cancel
Save