Commit Graph

85 Commits (252dea7016b961e81fb692730d6001412f878dda)

Author SHA1 Message Date
Your Name 667f6e2fc9 Extract following-ids lookup into FollowerService::getFollowingIds
The Cache::remember('profile:following:'.$pid, ...) block that plucks
following_id and appends the caller's own id was copy-pasted across four
call sites, with inconsistent TTLs (1440 minutes vs 1209600 seconds).

Add FollowerService::getFollowingIds($pid), which owns the cache key that
add()/remove() already invalidate, and use it from InternalApiController,
PublicApiController, ApiV1Controller and HashtagUnfollowPipeline. Removes
the now-unused Follower/Cache imports left behind.

Adds a test covering the followed-ids-plus-self result and the
follows-nobody case.
3 weeks ago
Your Name e7b70c6084 refactor: extract duplicate patterns into shared methods
1. Add FractalService with static item() and collection() helpers
   replacing 22 call sites that repeated the 4-line Fractal Manager
   + ArraySerializer boilerplate.

2. Add AccountInterstitial::createFromStatus() factory method
   consolidating 4 identical 15-line blocks that create interstitials
   with status metadata.

3. Add NotificationService::createNotification() to handle the
   repeated pattern of creating, caching, and registering a
   notification in the recipient's feed.

4. Add NotificationService::firstOrCreateNotification() for
   idempotent notifications (share/boost, mention) that should
   only notify once per actor+action+item combination.
4 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 2b1c9c818b polish 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
Shift 19880c2ffb
Convert string references to `::class`
PHP 5.5.9 adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP.
4 weeks ago
Daniel Supernault fbff6ed307
Update trustedproxy config 1 month ago
Daniel Supernault 9eeb7b6741
Update Status caption logic, stop storing duplicate html caption in db and defer to cached StatusService rendering 2 years ago
noellabo 2093d1b33b Change ISO-8601 to RFC 3339 EXTENDED 4 years ago
Daniel Supernault f8bc0d9c03
Update InternalApiController 5 years ago
Daniel Supernault a11772bcfe
Update BookmarkService, use sorted set 5 years ago
Daniel Supernault 34a3d65f30
Update InternalApiController 5 years ago
Daniel Supernault 3c35158ebc
Update InternalApiController, redirect remote post and profiles to Metro 2.0 5 years ago
Daniel Supernault aee9b994e3
Improve DiscoverService 5 years ago
Daniel Supernault f36da7816f
Update InternalApiController, use DiscoverService for discoverPosts method 5 years ago
Daniel Supernault 83b48b5681
Update StatusService, improve cache invalidation 5 years ago
Daniel Supernault 945a7e49f5
Update InternalApiController, prevent moderation actions against admin accounts 5 years ago
Daniel Supernault bc65938757
Add manual email verification requests 5 years ago
Daniel Supernault f215ee26b3
Update moderator api, expire cached status 5 years ago
Daniel Supernault 6d956a86f4
Add mark as spammer mod tool, unlists and applies content warning to existing and future posts 5 years ago
Daniel Supernault 7b9e0eefd3
Update InternalApiController formatting 5 years ago
Daniel Supernault b2501bfcc3
Update moderation api, invalidate profile embed 6 years ago
Daniel Supernault 063558e3ac
Update comment apis 6 years ago
Daniel Supernault 9862a85599
Update InternalApiController, update discoverPosts method to improve performance 6 years ago
Daniel Supernault 20681bcf14
Update InternalApiController, add interstitial logic 6 years ago
Daniel Supernault f8dc33cc81
Update InternalApiController 6 years ago
Daniel Supernault c251d41b2e
Update Discover, add trending hashtags, places and posts 6 years ago
Daniel Supernault c945263994
Update Tag People, allow untagging yourself 6 years ago
Daniel Supernault ee93f4598c
Update InternalApiController, add media tags 6 years ago
Daniel Supernault b1d5eb0556
Update Timeline component, fix mod tools 7 years ago
Daniel Supernault 9b37c439f7
Update InternalApiController, update modAction method 7 years ago
Daniel Supernault 7ef9056537
Update RemotePost component, fix missing like button on comments 7 years ago
Daniel Supernault d918a68e8b
Update InternalApiController, limit remote profile ui to remote profiles 7 years ago
Daniel Supernault 95bce31e62
Add remote posts and profiles 7 years ago
Daniel Supernault 758e633c2c
Update InternalApiController, fixes #1901 7 years ago
Daniel Supernault 1b20ebd46d
Deprecate mixed media albums 7 years ago
Daniel Supernault e7ad61c047
Update InternalApiController, fix compose api and php 7.4 compat 7 years ago
Daniel Supernault b3c18aecfd
Update InternalApiController, increase license limit to 140 to match UI counter 7 years ago
Daniel Supernault b13392f683
Update InternalApiController 7 years ago
Daniel Supernault a3ae352fd2
Update InternalApiController for ComposeUI v4 7 years ago
Daniel Supernault 820233adb1
Update InternalApiController, add places 7 years ago
Daniel Supernault 4c1d35cfa2
Update InternalApiController, add bookmarks api 7 years ago
Daniel Supernault 213fba725e
Update AccountController 7 years ago
Daniel Supernault 1cff278f9e
Update Api Controllers 7 years ago
Daniel Supernault 377394f0f2
Update AccountTransformer, cache status count 7 years ago
Daniel Supernault 8309c85d8b
Update InternalApiController 7 years ago