You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vibed/quotesdb/.beans/quotesdb-0wpo--submit-form-...

87 lines
2.7 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
# quotesdb-0wpo
title: 'Submit form: author optional (default Anonymous), clarify auth code auto-generation'
status: completed
type: bug
priority: normal
created_at: 2026-03-10T23:32:07Z
updated_at: 2026-03-10T23:32:07Z
---
## Bug
Two related UX issues on the submit form (`src/bin/ui/pages/submit.rs`):
### 1. Author field should be optional
Currently, `author` is required — the validation at line 53 returns early with `"Text and author are required."` if it is empty, and the field has `required=true` at line 177. Not all quotes have a known author, so it should be optional. When left blank, the API should receive `"Anonymous"` as the author.
### 2. Auth code label should clarify auto-generation
The label currently reads `"Custom auth code (optional)"`. The label itself does not explain what happens if left blank. The placeholder does say `"word-word-word-word (auto-generated if empty)"`, but users may not notice placeholders. The label should make it explicit.
## Expected behaviour
- Author field: leaving it blank submits the quote with author = `"Anonymous"`. The field should not block form submission.
- Auth code label: reads something like `"Custom auth code (optional — one will be generated if left blank)"`.
## How to fix
In `src/bin/ui/pages/submit.rs`:
**Author optional:**
1. Change the validation at line 53:
```rust
// Before
if text_val.is_empty() || author_val.is_empty() {
error.set(Some("Text and author are required.".to_string()));
return;
}
// After
if text_val.is_empty() {
error.set(Some("Quote text is required.".to_string()));
return;
}
```
2. When building `CreateQuoteInput`, default the author to `"Anonymous"` if empty:
```rust
author: if author_val.is_empty() {
"Anonymous".to_string()
} else {
author_val
},
```
3. Remove `required=true` from the author `<input>` (~line 177).
4. Update the label from `"Author *"` to `"Author (optional, defaults to Anonymous)"` or similar.
5. Update the placeholder from `"e.g. Mark Twain"` to `"e.g. Mark Twain (leave blank for Anonymous)"`.
**Auth code label:**
6. Change the label at line 236 from:
```
"Custom auth code (optional)"
```
to:
```
"Auth code (optional — one will be generated if left blank)"
```
## File
- `src/bin/ui/pages/submit.rs` (lines 5356, 6466, 163178, 235237)
## Validation
```sh
# From quotesdb/ root
cargo fmt && cargo check && cargo clippy && cargo test
trunk build
```
Manually test: submit a quote with author left blank — it should succeed and display `Anonymous` as the author.
## Commit scope
`fix(quotesdb): submit form author optional and auth code label`