Commit Graph

4315 Commits (47d98bfb55d25b11d417b921759b3c706eeb792d)

Author SHA1 Message Date
Your Name 4ce28d9144 feat: add framework integration tests for Laravel 12→13 upgrade readiness
Framework tests verify core Laravel integration points:
- ServiceProviderTest: app boot, guard resolution, route loading, config_cache
- RoutingTest: named routes, duplicates, api/oauth prefixes, middleware groups
- EloquentTest: User/Profile/Status factories, relationships, casts, soft deletes
- QueueTest: job dispatch, serialization, middleware, unique IDs
- ConfigTest: config loading, env overrides, auth/cache/queue settings
- MiddlewarePipelineTest: CSRF, auth, throttle, password confirm, 2FA, admin

Also:
- Add HasFactory trait to Status model
- Fix StatusFactory: remove non-existent 'place' column, add 'rendered' field
- Add Api/AccountTest for account endpoint coverage (254 total tests)
4 weeks ago
Your Name 97929f0876 fix: resolve str_ends_with TypeError in RegisterController
PHP's str_ends_with() only accepts a string needle, not an array.
The username validation was passing an array of extensions which
caused a TypeError on every registration attempt.

Replace with a loop over a configurable array of disallowed extensions,
making it easy to add new entries.

Also updates RegisterTest to properly test the registration flow
including the RT anti-bot token and age verification fields.
4 weeks ago
Your Name 8a2649b3ff feat: add critical path test suite and fix auth/config issues
Test Infrastructure:
- Modernize phpunit.xml (bootstrap, source block, Laravel 12 env vars)
- Configure tests/Pest.php with pest()->extend(TestCase::class)->in('Feature')
- Add docker-compose.test.yml (Redis for test suite)
- Add composer test/test:quick scripts
- Rename CACHE_DRIVER to CACHE_STORE across config (backwards compatible)
- Update .env.testing for in-memory SQLite + Docker Redis

Test Coverage (190 tests):
- CriticalRoutes: public routes, auth routes, API endpoints, middleware, schedule
- Auth/LoginTest: login, logout, rate limiting, redirect behavior
- Auth/RegisterTest: registration flow, validation, disabled registration
- Auth/PasswordResetTest: reset request, token validation, password update
- Auth/TwoFactorTest: 2FA checkpoint, setup behind password confirmation
- Auth/PasswordConfirmationTest: sudo mode flow via Laravel password.confirm
- Api/ScopeTest: scope enforcement, public endpoints, admin access

Bugs Fixed:
- Fix unauthenticated API returning 500 instead of 401 (AuthenticationException
  not handled in custom exception renderer in bootstrap/app.php)
- Replace custom DangerZone middleware with Laravel password.confirm
- Add HasFactory trait to Profile model for test factories

Bugs Documented (known-bugs group):
- Registration crashes with str_ends_with TypeError (RegisterController:82)
- OAuth routes use legacy array syntax causing ReflectionFunction TypeError
4 weeks ago
Your Name 1617734907 Revert "Merge pull request #6851 from pixelfed/fix/phpstan-auth-request-scope-2"
This reverts commit ce4baf6995, reversing
changes made to 9235cb979a.
4 weeks ago
Shlee ce4baf6995
Merge pull request #6851 from pixelfed/fix/phpstan-auth-request-scope-2
fix: replace Auth facade with $request->user() in request-scoped classes
4 weeks ago
Your Name 0939f495bb fix: replace Auth facade with $request->user() in request-scoped classes
Replace Auth::user() with $request->user() and Auth::check() with
$request->user() !== null (or ! $request->user()) across all
controllers and middleware that have access to the request object.

This resolves 99 larastan.noAuthFacadeInRequestScope errors and
improves Octane compatibility.

For protected helper methods without $request in scope, uses the
request() helper instead.

Methods that previously lacked a Request parameter but used Auth
facade now accept Request $request via Laravel's auto-injection.
4 weeks ago
Your Name f2159197e8 fix: add return type declarations to Eloquent relation methods
Larastan 3.x requires explicit return types on relation methods to
verify relation existence when using with(), has(), etc. This adds
the appropriate return type declarations to all relation methods
flagged by the larastan.relationExistence rule.

Models fixed:
- Profile (avatar, statuses)
- User (profile)
- Status (profile, media, hashtags)
- DirectMessage (status, author, recipient)
- Report (reporter, status, reportedUser)
- Like (actor, status)
- Media (status)
- Notification (item)
- HashtagFollow (hashtag)
- OauthClient (user)
- Story (profile)
- StatusHashtag (status, hashtag, profile, media)
- AccountInterstitial (user)
- Hashtag (posts)
- CustomFilter (keywords)
- CustomFilterKeyword (customFilter)
- AdminShadowFilter (profile)
- ImportPost (status)
4 weeks ago
Your Name e7ef58969c fix: resolve undefined $status variable in GroupsPostController::deletePost
Replace all references to non-existent $status with $gp (the GroupPost
instance already in scope). This was a bug where the closure variable
name was changed but references inside the method body were not updated.
4 weeks ago
Shlee fe9eae770e
Merge pull request #6848 from pixelfed/larascan
fix: replace backslash-prefixed facade calls with imported references
4 weeks ago
Your Name 7c964f3b4f fix: replace backslash-prefixed facade calls with imported references
Replace \Cache::, \Log::, \DB:: calls with their imported facade
equivalents. The backslash-prefix relies on global aliases which
PHPStan cannot resolve, causing class.notFound errors.
4 weeks ago
Shlee e86f424ec0
Merge pull request #6847 from pixelfed/larascan
Larascan level 0 fixes
4 weeks ago
Shlee 4bb9edcb22
Update StoryService.php 4 weeks ago
Shlee 58a34056ca
Update TimelineController.php 4 weeks ago
Shlee 942e15c652
Update StoryService.php 4 weeks ago
Shlee 2bc40e38f8
Merge pull request #6844 from pixelfed/fix/phpstan-static-method-not-found
fix: remove call to non-existent PollService::storyPoll()
4 weeks ago
Shlee c315b60867
Merge pull request #6843 from pixelfed/fix/phpstan-unnecessary-collection-call
fix: use query methods instead of collection methods
4 weeks ago
Shlee b7626891df
Merge pull request #6845 from pixelfed/fix/phpstan-variable-undefined
fix: resolve undefined variable bugs (phpstan variable.undefined)
4 weeks ago
Your Name e7ba43e2e1 fix: add missing use imports to resolve phpstan class.notFound errors
Add missing imports for Log, Cache, DB, FollowerService, StatusService,
LikeService, ReblogService, UserFilterService, AdminProfile, OauthClient,
and fix StatusTimelineTransformer reference (class didn't exist, replaced
with StatusTransformer).
4 weeks ago
Your Name 7bde84b23c fix: remove call to non-existent PollService::storyPoll()
The storyPoll() method was never implemented on PollService.
Replace with null to fix phpstan staticMethod.notFound.

Note: Passport::personalAccessClientId() is also flagged but deferred
to a separate PAT refactoring effort.
4 weeks ago
Your Name 49b85e9f22 fix: use query methods instead of collection methods (phpstan noUnnecessaryCollectionCall)
- PollService: pluck()->first() → value()
- StoryService: groupBy()->pluck()->count() → distinct()->count()
- Inbox: find($objects)->count() → whereIn('id', $objects)->count()
4 weeks ago
Your Name ccd75dd903 fix: resolve undefined variable bugs (phpstan variable.undefined)
- AdminReportController: fix closure param name and remove reference to
  undefined $meta variable
- GroupsPostController: replace $status with $gp (the actual GroupPost
  variable in scope)
- PortfolioController: replace undefined $metadata with null
- DeleteWorker: remove Cache::set() call with undefined $key
4 weeks ago
Your Name 43040a2275 fix: add missing property declarations (phpstan property.notFound)
- Add $fractal property and initialization to NewPublicPost event
- Add $mastodon and $pleroma property declarations to AudienceScopeTest
4 weeks ago
Your Name 58efefb878 fix: add missing FeedUnfollowPipeline import
Add missing use statement for FeedUnfollowPipeline in PrivacySettings
and FollowerObserver. These caused PHPStan internal errors blocking
full analysis.
4 weeks ago
Shlee 572047280f
Merge pull request #6830 from pixelfed/refactor/modern-bootstrap-app
refactor: migrate to modern Laravel 13+ bootstrap/app.php
4 weeks ago
Shlee 899e360b48
Update Extractor.php 4 weeks ago
Your Name c807a8524c refactor: replace short facade aliases with fully-qualified imports
Convert all 273 short facade alias imports (e.g. 'use Cache;') to their
fully-qualified class names (e.g. 'use Illuminate\Support\Facades\Cache;')
across 193 files.

This resolves 643 PHPStan 'class.notFound' errors caused by the static
analyzer being unable to resolve global aliases, and aligns with modern
Laravel conventions. It also unblocks removing the aliases array from
config/app.php in a future change.

All 107 tests pass.
4 weeks ago
Your Name ee7d7124d0 refactor: remove thin middleware wrappers, use framework classes directly
Delete 4 middleware wrapper classes that added no custom logic:
- EncryptCookies (empty $except)
- TrimStrings ($except matches framework default)
- VerifyCsrfToken (exceptions moved to validateCsrfTokens() in bootstrap)
- TrustProxies (headers matched framework default)

CSRF exceptions (/api/v1/*, oauth/token) are now configured via
$middleware->validateCsrfTokens(except: [...]) in bootstrap/app.php.

All 107 tests pass.
4 weeks ago
Daniel Supernault 443f29acc9
Update AccountService.php 4 weeks ago
Your Name 8e41f6fdf8 refactor: migrate to modern bootstrap/app.php architecture
Consolidate the legacy Laravel 5-era kernel/handler architecture into
the modern Application::configure() pattern introduced in Laravel 11:

- HTTP middleware stack → bootstrap/app.php withMiddleware()
- Console schedule → bootstrap/app.php withSchedule()
- Exception handling → bootstrap/app.php withExceptions()
- Route registration → bootstrap/app.php withRouting()
- Service providers → bootstrap/providers.php

Deleted files:
- app/Http/Kernel.php
- app/Console/Kernel.php
- app/Exceptions/Handler.php
- app/Providers/RouteServiceProvider.php
- app/Providers/BroadcastServiceProvider.php

Removed framework providers from config/app.php (auto-registered by
Application::configure). Package providers use auto-discovery.

All 107 tests pass. Schedule, routes, and middleware verified working.
4 weeks ago
Your Name faa216b329 refactor: replace str_limit() with Str::limit()
Replace remaining 3 deprecated str_limit() calls with Str::limit().
No other deprecated str_* helpers remain in the codebase.
4 weeks ago
Your Name 98267eb26f refactor: replace deprecated str_random() with Str::random()
str_random() is a deprecated helper from laravel/helpers that was
missed in the initial helpers removal. Replace all 18 call sites
with the modern Str::random() equivalent.
4 weeks ago
Shlee 31330d46fa
Merge pull request #6817 from pixelfed/refactor/event-service-provider-syntax
refactor: use ::class syntax in EventServiceProvider
4 weeks ago
Your Name 741bc995ca refactor: use ::class syntax in EventServiceProvider
Replace string-based event class references with proper ::class imports
for better IDE support and static analysis compatibility.
4 weeks ago
Your Name edb4368b08 refactor: replace deprecated laravel/helpers with native alternatives
Replace all deprecated helper function calls:
- str_slug() → Str::slug()
- starts_with() → str_starts_with()
- ends_with() → str_ends_with()
- array_first() → Arr::first()
- array_last() → Arr::last()
- array_flatten() → Arr::flatten()

Remove laravel/helpers package from composer.json as it is no longer
needed and will not be maintained for Laravel 13.
4 weeks ago
Your Name 28927f6f66 refactor: convert string-based routes to ::class array syntax
Replace all 'Controller@method' string references with
[Controller::class, 'method'] array syntax across all route files.
Remove the $namespace property and ->namespace() calls from
RouteServiceProvider.

This is required for Laravel 13 compatibility where string-based
controller routing and automatic namespace prefixing will be removed.

742 route references converted across 5 route files.
4 weeks ago
Daniel Supernault 8f1e475407
Fix typo 4 weeks ago
Shlee 3c88343a52
Merge pull request #6813 from pixelfed/refactor/middleware-aliases-property
refactor: rename $routeMiddleware to $middlewareAliases
4 weeks ago
Shlee 1593fb71b8
Merge pull request #6811 from pixelfed/refactor/replace-maintenance-mode-middleware
refactor: replace deprecated CheckForMaintenanceMode with PreventRequestsDuringMaintenance
4 weeks ago
Your Name d2bd73c27e refactor: rename $routeMiddleware to $middlewareAliases
The $routeMiddleware property was renamed to $middlewareAliases in Laravel 11.
The old name still works in 12 via backwards compatibility but is on the
deprecation path for removal in Laravel 13.
4 weeks ago
Your Name f363715ad8 refactor: replace deprecated CheckForMaintenanceMode with PreventRequestsDuringMaintenance
CheckForMaintenanceMode was deprecated in Laravel 8 and will be removed in
Laravel 13. PreventRequestsDuringMaintenance is the modern replacement with
support for secret bypass tokens and pre-rendered maintenance views.
4 weeks ago
Daniel Supernault 7937d91c37
Update ApiV1Controller, add is_suggestable to update_credentials endpoint 4 weeks ago
Daniel Supernault 4e2e49f843
Update ApiV1Controller, add show_atom support to update_credentials endpoint 4 weeks ago
Daniel Supernault 59f57b1107
Update AccountService 4 weeks ago
Your Name 79541afaa0 Merge origin/staging, resolve conflicts keeping matomo/device-detector over jenssegers/agent 4 weeks ago
Shlee 80738385ba
Merge pull request #6777 from pixelfed/fix/pat-creation-500-6630
Fix: Bounce error on PAT when OAUTH_PAT_ENABLED is false
4 weeks ago
Shlee 06e3351e92
Merge pull request #6778 from pixelfed/fix/prevent-pat-client-deletion-6630
Fix: Improve the web UX for deleting the OAuth Client and PAT
4 weeks ago
Shlee ad8f783bf7
Merge pull request #6798 from pixelfed/unstable
Unstable
4 weeks ago
Shlee fb655f1308
Merge pull request #6782 from ashleyhull-versent/shift-179490
Laravel Shift Preshift
4 weeks ago
Ashley Hull ab07a705e6
Merge branch 'dev' into shift-179490 4 weeks ago
Shlee 68dca50973
Merge pull request #6774 from pixelfed/fix/oauth-scope-bypass-remove-follower-6643
Fix: OAuth accountRemoveFollowById to check token.
4 weeks ago