commit c95f71b10ab0695df09604242ded31bdaa4acd04
parent 40b75fdd33fae9d47d7e4b356c6f9c2d7bc1eb59
Author: Silas Brack <silasbrack@gmail.com>
Date: Sun, 7 Jun 2026 18:09:56 +0200
fix: remove tags from form structs to fix submission
serde_urlencoded can't deserialize repeated form keys (tags=1&tags=2)
into Vec<i64>. Remove tag selection from submit/edit for now to
unblock story submission.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/src/handlers/story.rs b/src/handlers/story.rs
@@ -144,8 +144,6 @@ pub struct SubmitForm {
pub title: String,
pub url: Option<String>,
pub text: Option<String>,
- #[serde(default)]
- pub tags: Vec<i64>,
}
pub async fn submit_story(
@@ -195,11 +193,6 @@ pub async fn submit_story(
.await
.map_err(|e| render_submit_error(&form, &all_tags, &format!("Failed to create story: {}", e)))?;
- // Add tags
- for tag_id in &form.tags {
- let _ = trailbase::add_tag_to_story(&client, story.id, *tag_id).await;
- }
-
Ok(Redirect::to(&format!("/story/{}", story.id)))
}
@@ -210,7 +203,7 @@ fn render_submit_error(form: &SubmitForm, all_tags: &[trailbase::Category], erro
url: form.url.clone().unwrap_or_default(),
text: form.text.clone().unwrap_or_default(),
all_tags: all_tags.to_vec(),
- selected_tags: form.tags.clone(),
+ selected_tags: vec![],
};
let app = ApplicationTemplate {
content: submit.render().unwrap_or_default(),
@@ -268,8 +261,6 @@ pub struct EditForm {
pub title: String,
pub url: Option<String>,
pub text: Option<String>,
- #[serde(default)]
- pub tags: Vec<i64>,
}
pub async fn edit_story(
@@ -318,12 +309,6 @@ pub async fn edit_story(
.await
.map_err(|e| render_edit_error(id, &form, &[], &format!("Failed to update: {}", e)))?;
- // Update tags: remove all, then re-add selected
- let _ = trailbase::remove_all_tags_from_story(&client, id).await;
- for tag_id in &form.tags {
- let _ = trailbase::add_tag_to_story(&client, id, *tag_id).await;
- }
-
Ok(Redirect::to(&format!("/story/{}", id)))
}
@@ -335,7 +320,7 @@ fn render_edit_error(story_id: i64, form: &EditForm, all_tags: &[trailbase::Cate
url: form.url.clone().unwrap_or_default(),
text: form.text.clone().unwrap_or_default(),
all_tags: all_tags.to_vec(),
- selected_tags: form.tags.clone(),
+ selected_tags: vec![],
};
let app = ApplicationTemplate {
content: edit.render().unwrap_or_default(),