Commit Graph

35 Commits (d70076505de3878a702329bb6d053750f9cea3d5)

Author SHA1 Message Date
Daniel Supernault e0073e0de4
Fix typos and Lint 4 days ago
Your Name 28b11b9b35 Larastan 2 6 days ago
Your Name 2be73c4879 Larastan Level 1 6 days ago
Your Name 9fde74082a add type to function 6 days ago
Your Name 0d999f5dda added return type to function 6 days ago
Your Name 5ebc1af91e BATCH 1 6 days ago
Your Name 29280cd950 Fix silent failure in avatar upload endpoints
AvatarController@store and BaseApiController@avatarUpdate wrapped the
upload flow in an empty catch(\Exception) block and returned a success
response even when the upload or save failed.

Log the exception and return a real error response (500 JSON for the
API endpoint, a redirect with validation errors for the web endpoint).

Adds regression tests covering the failure path, the success path, and
non-image rejection.
3 weeks ago
Your Name 400f00c5e1 feat: storage:maintenance command + in-flow cleanup of emptied dirs
Replace the remcache GC (GarbageCollectorRemcache / gc:remcache) with a
broader storage:maintenance command that sweeps stale remcache temp files and
recursively removes the random empty directories accumulated under the media,
story, avatar and import trees (--hours/--only/--except/--dry-run), scheduled
daily.

Fix the root causes so flows clean up after themselves rather than relying on
the sweep:
- MediaDeletePipeline removes its own emptied m/_v2 leaf dir
- AvatarOptimize logs the previously-swallowed exception, still cleans up the
  old avatar on failure, and removes the old file's now-empty splayed dir
- AvatarController::deleteAvatar removes the emptied splayed dir
- StoryExpire/StoryDelete remove the story's own emptied leaf dir
- TransformImports removes imports/{userId} once its files are moved out
- StoryFetch cleans up its remcache temp file in a finally block
3 weeks ago
Your Name c0cde2f682 refactor: move 52 legacy models from App\ to App\Models\
Move all Eloquent models from the app/ root directory to app/Models/
for consistency with modern Laravel conventions. The project already had
54 models in App\Models; this migrates the remaining 52 legacy models.

Changes:
- Move 52 model files from app/ to app/Models/
- Update namespace declarations in each model
- Update all ~1000 import references across the codebase
- Add Relation::morphMap() in AppServiceProvider for backward
  compatibility with existing polymorphic database records
- Add missing HasSnowflakePrimary imports for models that relied
  on same-namespace resolution
4 weeks ago
Your Name 54cfdf3c2b refactor: add return type declarations to controller methods
Adds explicit return type declarations to 498 controller methods
across 88 files. Types inferred from return statements:

- JsonResponse for response()->json() returns
- RedirectResponse for redirect()/back() returns
- View (contract) for view() returns
- Response for response() returns
- void for methods with no return value
- array for array returns
- string/int/bool for scalar returns

Also fixes 3 methods with incorrect bare returns:
- AvatarController::deleteAvatar - bare return → json response
- ImportPostController::checkPermissions - bare return → true
- RemoteAuthController::accountToId - bare return → empty array
4 weeks ago
Your Name ffcef3eb2d 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 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
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 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 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
Daniel Supernault 374344754e
Lint 9 months ago
Your Name ca6c875bbb Fix PHPStan class.notFound issues 11 months ago
Daniel Supernault 22da2647c7
Update filesystems, store all files as public by default and add default permissions. Fixes #4273, #4275. Closes #3825 4 years ago
Daniel Supernault 7fa9d4dc1b
Update AvatarController, fix store bug 5 years ago
Daniel Supernault bae6126db3
Update compiled assets 5 years ago
Daniel Supernault 889c3d8758
Update AvatarController, remove deprecated thumb_path 6 years ago
Daniel Supernault 5fffe1d0dd
Update AvatarController 6 years ago
Daniel Supernault f6528c8470
Update avatars, use jpeg default 6 years ago
Daniel Supernault 6644c69366
Update AvatarController 7 years ago
Daniel Supernault 066f1a9282
Update BaseApiController, cache verify_credentials endpoint 8 years ago
Daniel Supernault b7547a4ad4
Update AvatarController 8 years ago
Daniel Supernault a2641dfc78
Update AvatarController 8 years ago
Daniel Supernault 0b9a5a26ad
Update AvatarController 8 years ago
Daniel Supernault b85d351bc5
Update avatar logic, allow custom file size limits. Fixes #654 8 years ago
Daniel Supernault 3cbe367869
Update AvatarController 8 years ago
daniel b8abbdd90f Apply fixes from StyleCI 8 years ago
Daniel Supernault d6970d930f
Add avatar cache busting logic 8 years ago
Daniel Supernault 85e4e9cf65
Update AvatarController, set max avatar size to 2mb 8 years ago
Daniel Supernault f4f7909a06
Update web routes 8 years ago
Daniel Supernault 4ab0515e76 Add AvatarController 8 years ago