Skip to content

Commit

Permalink
fix(server): Fix deleted Content in Dashboard (CCMS-150)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Ostheimer committed Oct 2, 2019
1 parent b5728a5 commit 7a7e98d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions client/src/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export default function Dashboard() {
<Container>
{totalCount && (
<Title>
There exist <b>{totalCount.total.toLocaleString()}</b> contents and
you already worked on <b>{totalCount.totalByUser.toLocaleString()}</b>{" "}
of them
There are already <b>{totalCount.total.toLocaleString()}</b> items and
you worked on <b>{totalCount.totalByUser.toLocaleString()}</b> of
them.
</Title>
)}
<Flex>
Expand Down
6 changes: 2 additions & 4 deletions client/src/common/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ export type Props = React.SVGProps<SVGSVGElement> & {
ref?: any;
};

const SVG = styled("svg")``;

export default function Icon({ path, ...props }: Props) {
return (
<SVG
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
{...props}
>
<path d={path} fill="currentColor" />
</SVG>
</svg>
);
}
2 changes: 1 addition & 1 deletion client/src/common/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const paths = {

type Props = Partial<IconProps>;

const icons: { [index: string]: React.ComponentType<Props> } = {};
const icons: { [index: string]: React.FC<Props> } = {};

Object.entries(paths).forEach(([name, path]) => {
icons[name] = (props: Props) => <Icon {...props} path={path} />;
Expand Down
7 changes: 4 additions & 3 deletions src/persistence/adapter/knex/KnexContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export default class KnexContent implements ContentAdapter {
models: Cotype.Model[],
author: string
) {

await this.testUniqueFields(model, models, storeData);

const [id] = await this.knex("contents")
Expand Down Expand Up @@ -1463,7 +1462,8 @@ export default class KnexContent implements ContentAdapter {
join.on("contents.latest_rev", "cr.rev");
})
.join("users", "users.id", "cr.author")
.whereIn("type", models);
.whereIn("type", models)
.andWhere("contents.deleted", false);
if (user) {
k.andWhere("cr.author", user);
}
Expand Down Expand Up @@ -1503,7 +1503,8 @@ export default class KnexContent implements ContentAdapter {
this.knex.raw("contents.published_rev")
)
.orWhere("contents.published_rev", null)
.whereIn("type", models);
.whereIn("type", models)
.andWhere("contents.deleted", false);

const [count] = await k.clone().count("contents.id as total");
const total = Number(count.total);
Expand Down

0 comments on commit 7a7e98d

Please sign in to comment.