summaryrefslogtreecommitdiffstats
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
parentf856b2be4fd67785ba8791df8481bb5037659ecf (diff)
Add infoBox for non-approved posts
-rw-r--r--res/lang/en.ftl1
-rw-r--r--res/lang/eo.ftl1
-rw-r--r--src/resp_types.rs1
-rw-r--r--src/routes/posts.rs7
4 files changed, 10 insertions, 0 deletions
diff --git a/res/lang/en.ftl b/res/lang/en.ftl
index 2f0aee7..2040948 100644
--- a/res/lang/en.ftl
+++ b/res/lang/en.ftl
@@ -52,6 +52,7 @@ post_delete_question = Delete this post?
post_delete_title = Delete Post
post_likes_nothing = Looks like nobody has liked this post yet.
post_new = New Post
+post_not_approved = This post has not been approved by the community.
register = Register
remote = Remote
reply = reply
diff --git a/res/lang/eo.ftl b/res/lang/eo.ftl
index f767b96..e62db7c 100644
--- a/res/lang/eo.ftl
+++ b/res/lang/eo.ftl
@@ -52,6 +52,7 @@ post_delete_question = Ĉu vi volas forigi ĉi tiun poŝton?
post_delete_title = Forigi Poŝton
post_likes_nothing = Ŝajnas, ke neniu ankoraŭ ŝatis ĉi tion poŝton.
post_new = Nova Poŝto
+post_not_approved = Ĉi tiu poŝto ne estas aprobita per la komunumo.
register = Registriĝi
remote = Fora
reply = respondi
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)}>