Commit Graph

4 Commits (dev)

Author SHA1 Message Date
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 1183aff2c1
Merge pull request #7816 from pixelfed/fix/userfilter-legacy-morph
Match legacy App\Profile morph type in user_filters block and mute queries
1 week ago
Ashley 6930073035 Match legacy App\Profile morph type in user_filters block and mute queries
Read and delete paths for user_filters now match both the legacy App\Profile and current App\Models\Profile morph strings, so pre-migration block/mute rows are visible and removable again. Write paths keep the canonical class. Adds a migration that deduplicates then normalizes legacy rows.
1 week ago
Ashley 07ef29fb52 Constrain user_filters cold rebuild to profile morph types
The cold rebuild in UserFilterService::getFilterIds() repopulates the
Redis mute/block id lists from user_filters filtered only by filter_type
and user_id. It never constrained filterable_type, so rows belonging to
other morph models were pulled in and their filterable_id treated as a
profile id. Legacy App\Instance block rows whose filterable_id collides
with a real profile id made an unrelated account appear blocked/muted:
hidden from timelines, surfaced by the blocks/mutes endpoints, and
miscounted by blockCount()/muteCount(). The phantom could not be cleared
through the type-guarded unblock paths and was reintroduced every time
the 30-day cache key expired.

Scope the rebuild query to the Profile morph, accepting both the current
App\Models\Profile value and the legacy App\Profile string so valid
pre-namespace-move blocks and mutes are preserved.

Verified with tests/Feature/UserFilter/ColdRebuildTypeGuardTest.php
(SQLite :memory:, Redis on 6379):
- Before the fix: 3 failed - each asserting the rebuilt id list must not
  contain the unrelated profile id introduced via the App\Instance row.
- After the fix: 3 passed (10 assertions) - modern and legacy profile
  blocks/mutes are kept, the App\Instance row is excluded, and
  blockCount/muteCount reflect only the real profile entries.
1 week ago