summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorColin Reeder <colin@vpzom.click>2020-07-31 10:19:52 -0600
committerColin Reeder <colin@vpzom.click>2020-07-31 10:19:52 -0600
commitda1441451d5cad51aed5148c89cd8219b34fb6c9 (patch)
tree5d52175ea2d94cb05ca1238659a0fc18cfb46514 /src
parentf856b2be4fd67785ba8791df8481bb5037659ecf (diff)
Add infoBox for non-approved posts
Diffstat (limited to 'src')
-rw-r--r--src/resp_types.rs1
-rw-r--r--src/routes/posts.rs7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/resp_types.rs b/src/resp_types.rs
index d32e69b..b51b26c 100644
--- a/src/resp_types.rs
+++ b/src/resp_types.rs
@@ -110,6 +110,7 @@ pub struct RespPostInfo<'a> {
pub content_text: Option<Cow<'a, str>>,
pub content_html: Option<Cow<'a, str>>,
+ pub approved: bool,
pub score: i64,
#[serde(borrow)]
pub comments: Vec<RespPostCommentInfo<'a>>,
diff --git a/src/routes/posts.rs b/src/routes/posts.rs
index 86a3134..2f26686 100644
--- a/src/routes/posts.rs
+++ b/src/routes/posts.rs
@@ -48,6 +48,13 @@ async fn page_post(
Ok(html_response(render::html! {
<HTPage base_data={&base_data} lang={&lang} title={title}>
+ {
+ if post.approved {
+ None
+ } else {
+ Some(render::rsx! { <div class={"infoBox"}>{lang.tr("post_not_approved", None)}</div> })
+ }
+ }
<h1>{title}</h1>
<p>
<a href={format!("/posts/{}/likes", post_id)}>