diff --git a/src/api/comments/create.rs b/src/api/comments/create.rs index 7cb5db2..ca1abd6 100644 --- a/src/api/comments/create.rs +++ b/src/api/comments/create.rs @@ -9,7 +9,6 @@ pub async fn create_comment( author_email: String, author_url: Option, content_md: String, - consented: bool, ) -> Result { #[cfg(feature = "server")] { @@ -33,14 +32,6 @@ pub async fn create_comment( } } - if !consented { - return Ok(CommentResponse { - success: false, - message: "请同意隐私政策".to_string(), - error_code: Some("invalid_input".into()), - }); - } - if let Err(e) = validate_comment_name(&author_name) { return Ok(CommentResponse { success: false, @@ -200,8 +191,8 @@ pub async fn create_comment( .query_one( "INSERT INTO comments \ (post_id, parent_id, depth, author_name, author_email, author_url, \ - content_md, content_html, content_hash, status, ip_address, user_agent, consented_at) \ - VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, 'pending', $10, $11, NOW()) \ + content_md, content_html, content_hash, status, ip_address, user_agent) \ + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, 'pending', $10, $11) \ RETURNING id", &[ &post_id, diff --git a/src/components/comments/form.rs b/src/components/comments/form.rs index 159368e..06fe3de 100644 --- a/src/components/comments/form.rs +++ b/src/components/comments/form.rs @@ -14,7 +14,6 @@ pub fn CommentForm(post_id: i32, parent_id: Option) -> Element { let mut author_url = use_signal(String::new); let mut content_md = use_signal(String::new); let mut honeypot = use_signal(String::new); - let mut consented = use_signal(|| false); let mut submitting = use_signal(|| false); let mut message = use_signal(|| Option::<(String, &'static str)>::None); @@ -103,22 +102,6 @@ pub fn CommentForm(post_id: i32, parent_id: Option) -> Element { oninput: move |e| honeypot.set(e.value()), } - div { class: "flex items-start gap-2", - input { - r#type: "checkbox", - id: "consent-{post_id}-{parent_id.unwrap_or(0)}", - checked: consented(), - disabled: submitting(), - class: "mt-1 rounded border-gray-300 text-paper-accent focus:ring-paper-accent/30", - onchange: move |e| consented.set(e.checked()), - } - label { - r#for: "consent-{post_id}-{parent_id.unwrap_or(0)}", - class: "text-sm text-paper-secondary select-none cursor-pointer", - "同意隐私政策" - } - } - button { class: BUTTON_PRIMARY_CLASS, disabled: submitting(), @@ -130,7 +113,6 @@ pub fn CommentForm(post_id: i32, parent_id: Option) -> Element { let url_val = author_url(); let content = content_md(); let hp = honeypot(); - let consent = consented(); if !hp.is_empty() { return; @@ -141,11 +123,6 @@ pub fn CommentForm(post_id: i32, parent_id: Option) -> Element { return; } - if !consent { - message.set(Some(("请同意隐私政策".to_string(), "error"))); - return; - } - submitting.set(true); message.set(None); @@ -157,7 +134,6 @@ pub fn CommentForm(post_id: i32, parent_id: Option) -> Element { email, if url_val.trim().is_empty() { None } else { Some(url_val) }, content, - consent, ).await; submitting.set(false); @@ -166,7 +142,6 @@ pub fn CommentForm(post_id: i32, parent_id: Option) -> Element { Ok(resp) => { if resp.success { content_md.set(String::new()); - consented.set(false); message.set(Some((resp.message, "success"))); if parent_id.is_some() { active_reply.set(None);