Commit Graph

9 Commits (dev)

Author SHA1 Message Date
Shlee 07afdc8f4f
Merge pull request #7839 from pixelfed/fix/edit-mentions-hashtags
Re-derive mentions and hashtags when a post is edited
1 week ago
Ashley 463608e283 Re-derive mentions and hashtags when a post is edited
Editing a local post saved the new caption but never re-lexed it, so
Mention/StatusHashtag rows (written only at creation by StatusEntityLexer)
went stale. UpdateNote.object.tag and scopeToAudience('cc') kept emitting the
old entity set while content HTML regenerated live: new remote mentions were
never delivered/notified, removed mentions stayed cc'd, and edits never entered
newly added hashtag feeds remotely.

Add StatusEntityReconciler::reconcile(), which re-runs the Extractor over the
edited caption and reconciles rows using the same primitives as the lexer:
create/restore Mention rows (dispatching MentionPipeline for newly added ones
only), soft-delete dropped mentions, firstOrCreate StatusHashtag rows and
hard-delete dropped ones (never touching the shared Hashtag row). Wired into
UpdateStatusService::call() only when the caption changed, so captions whose
entities are unchanged keep identical behavior and dispatch nothing. Edit
history and media handling are untouched.

Scoped to local edits. StatusRemoteUpdatePipeline (incoming remote edits) has
the same staleness but its own media/NSFW handling and tests; left as a
follow-up. Live-deriving tag entries in UpdateNote is unnecessary once rows are
reconciled; left as an optional defensive follow-up.

Verification (run from the worktree via ddev, sqlite :memory:):
- tests/Feature/Status/EditReLexEntitiesTest.php: 2 passed.
- Red/green: with the reconcile call commented out, the swap/payload case fails
  (new mention row absent, tag/cc stale) and the control case passes; with it
  restored both pass.
- tests/Feature/Status + tests/Feature/StatusPipeline: 29 passed.
- pint --test on the changed files: clean.
1 week ago
Ashley 1df355b82a Return 404 for reply permalinks whose parent was deleted
Status::parent() returns null once a parent is soft- or force-deleted, so the reply permalink page dereferenced null and threw a 500 for guests. StatusController::show() now aborts 404 when a reply's parent is gone, and reply.blade.php guards the parent/grandparent blocks so rendering can never null-deref.

Verified red->green: before the fix the soft-delete and force-delete cases returned 500 (Call to a member function parent() on null); after the fix all three cases pass (parent alive 200, soft-deleted 404, force-deleted 404).
1 week ago
Ashley dfa054f60a Fix test collisions that broke the full suite
Resolve name clashes that only surfaced when running the whole suite
together rather than files in isolation:

- Drop the redundant uses(TestCase::class) from two Feature tests; the
  TestCase binding already comes from tests/Pest.php, and binding it
  twice throws TestCaseAlreadyInUse.
- Rename the per-file seedFilter() helpers to seedCustomFilter() and
  seedUserFilter() so the two files no longer redeclare the same global
  function.
- Configure a captcha driver in two CaptchaManagerTest cases so they
  assert per-surface behaviour instead of the unconfigured-driver path.
1 week ago
Shlee f121317748
Merge pull request #7810 from pixelfed/fix/nsfw-feed-reconcile-gates
Apply public feed eligibility gates when restoring edited status
1 week ago
Ashley 3dcd5bce37 Apply public feed eligibility gates when restoring edited status 1 week ago
Ashley 1b3f39a177 Fix private child reply visibility leak on reply permalink page 1 week ago
Your Name c32642e686 Clear place status caches after save to close invalidation race
handleImmediateAttributes cleared the old and new per-place status-id
caches while place_id was only mutated in memory, before $status->save()
committed the change. A concurrent PlaceController::show read landing in
that window re-warmed the old place cache from the pre-move DB state,
pinning a stale membership list for the 4-day TTL.

Move both PlaceService::clearStatusesByPlaceId calls to after save() so
the cache can only be re-warmed from post-move DB state. Add a regression
test that re-warms the old place cache during the updating event (fired
inside save, before the DB write) and asserts it does not survive.
1 month ago
Your Name acc5c930d6 Invalidate place status caches on API publish and location edits 1 month ago