From 3ed0df90a14ecfb2192ec80d0f14cac3833b4889 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 25 Nov 2024 12:17:09 +0100 Subject: [PATCH] Add message about new article approval --- src/frontend/app.rs | 8 ++++++-- src/frontend/pages/article/create.rs | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/frontend/app.rs b/src/frontend/app.rs index f9f5302..c38d2b1 100644 --- a/src/frontend/app.rs +++ b/src/frontend/app.rs @@ -6,8 +6,12 @@ use crate::{ dark_mode::DarkMode, pages::{ article::{ - actions::ArticleActions, create::CreateArticle, edit::EditArticle, - history::ArticleHistory, list::ListArticles, read::ReadArticle, + actions::ArticleActions, + create::CreateArticle, + edit::EditArticle, + history::ArticleHistory, + list::ListArticles, + read::ReadArticle, }, diff::EditDiff, instance::{details::InstanceDetails, list::ListInstances}, diff --git a/src/frontend/pages/article/create.rs b/src/frontend/pages/article/create.rs index 896e849..98730a9 100644 --- a/src/frontend/pages/article/create.rs +++ b/src/frontend/pages/article/create.rs @@ -1,6 +1,10 @@ use crate::{ common::CreateArticleForm, - frontend::{api::CLIENT, components::editor::EditorView}, + frontend::{ + api::CLIENT, + app::{is_admin, site, DefaultResource}, + components::editor::EditorView, + }, }; use leptos::{html::Textarea, prelude::*}; use leptos_router::components::Redirect; @@ -47,9 +51,19 @@ pub fn CreateArticle() -> impl IntoView { } } }); + let show_approval_message = Signal::derive(move || { + site().with_default(|site| site.config.article_approval) && !is_admin() + }); view! {

Create new Article

+ + +
+ New articles require admin approval before being published +
+
+