fix: add length-based filtering for posts, matching comments (#559, #704)
Closes #559
Closes #704
## Summary
- Adds `SUBMISSION_BODY_LENGTH_MAXIMUM_UNFILTERED` constant (50,000 characters), matching the existing comment constant
- Posts exceeding 50k characters from non-admin users are now filtered (pending approval), matching comment behavior
- Both posts and comments now enforce: **50k unfiltered, 500k max (filtered)** per [maintainer decision](https://github.com/themotte/rDrama/issues/559#issuecomment-1493600840)
## Changes
- `files/helpers/config/const.py` -- Added `SUBMISSION_BODY_LENGTH_MAXIMUM_UNFILTERED = 50000`; removed stale "these are filtered anyway" comment
- `files/routes/posts.py` -- Extracted `is_filtered` logic from inline ternary; added body-length check against the new unfiltered limit (same pattern as `comments.py` lines 172-176)
## Notes
- The comment limits were already correct (50k/500k). The bug was that posts had no length-based filtering at all (#704)
- Database columns are `Text` type so no migration needed
- Frontend `maxlength` on the submit textarea correctly uses `SUBMISSION_BODY_LENGTH_MAXIMUM` (500k) since oversize posts are filtered, not rejected
## Testing
6 tests added in `files/tests/test_character_limits.py`:
| Test | Behavior |
|------|----------|
| `test_post_under_50k_not_filtered` | Post with body < 50k chars is VISIBLE |
| `test_post_exactly_50k_not_filtered` | Post with body = 50k chars is VISIBLE (boundary) |
| `test_post_over_50k_filtered` | Post with body > 50k chars is FILTERED |
| `test_post_over_50k_admin_not_filtered` | Admin (level 3) post with body > 50k is VISIBLE |
| `test_comment_under_50k_not_filtered` | Comment < 50k remains VISIBLE (regression) |
| `test_comment_over_50k_filtered` | Comment > 50k is FILTERED (regression) |
All 37 tests pass (26 existing post + 5 existing comment + 6 new).
合并状态:未合并 1 条评论