Skip to content

Commit

Permalink
fix: fix collection children api
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Nov 26, 2023
1 parent fbadda0 commit d85b615
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "writing"
version = "1.3.14"
version = "1.3.15"
edition = "2021"
rust-version = "1.64"
description = ""
Expand Down
40 changes: 19 additions & 21 deletions src/api/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,9 +1058,7 @@ pub async fn list_children(
output.summary = doc.summary;
output.cover = doc.cover;
output.kind = 1;
}

if icreation.gid == user_gid {
} else if icreation.gid == user_gid {
// get for owner
if let Ok(doc) = db::Publication::get_implicit_one(
&app.scylla,
Expand All @@ -1083,24 +1081,24 @@ pub async fn list_children(
output.cover = doc.cover;
output.kind = 1;
}
}

let mut doc = db::Creation::with_pk(icreation.gid, icreation.id);
if doc
.get_one(&app.scylla, publication_fields.clone())
.await
.is_ok()
&& doc.status >= status
{
output.gid = to.with(doc.gid);
output.status = doc.status;
output.updated_at = doc.updated_at;
output.language = to.with(doc.language);
output.version = doc.version;
output.title = doc.title;
output.summary = doc.summary;
output.cover = doc.cover;
output.kind = 0;
} else {
let mut doc = db::Creation::with_pk(icreation.gid, icreation.id);
if doc
.get_one(&app.scylla, publication_fields.clone())
.await
.is_ok()
&& doc.status >= status
{
output.gid = to.with(doc.gid);
output.status = doc.status;
output.updated_at = doc.updated_at;
output.language = to.with(doc.language);
output.version = doc.version;
output.title = doc.title;
output.summary = doc.summary;
output.cover = doc.cover;
output.kind = 0;
}
}
}
}
Expand Down

0 comments on commit d85b615

Please sign in to comment.