Commit Graph

59 Commits (b53b2d5023e0eaf5a9f01c73fb60390a808a676d)

Author SHA1 Message Date
Daniel Supernault 2378df0545
Fix DirectMessageController composeMutuals pagination 11 hours ago
Daniel Supernault 138b8a2109
Update DirectMessageController, fix composeLookup format with pf entity 11 hours ago
Daniel Supernault 9c81a75ad3
Refactor Direct Messages, add Group Chat support and proper context threading with Mastodon 2 days ago
Your Name 5ebc1af91e BATCH 1 6 days ago
Your Name e3b6cebf27 Fix MariaDB driver detection and reblog caption null inserts
Laravel 11 exposes MariaDB as a dedicated 'mariadb' driver, so
config('database.default') === 'mysql' checks silently misclassified
MariaDB as the non-mysql (postgres) branch.

- Add App\Util\Database\DatabaseDriver with isMysqlLike()/isPgsql()
  plus db_is_mysql_like()/db_is_pgsql() global helpers.
- Route all database.default driver checks through the helpers so
  MySQL and MariaDB are treated as one group.
- Use '' (not null) for share/compose caption+rendered, valid whether
  the column is nullable or NOT NULL (it is NOT NULL on MySQL/MariaDB).
- Guard pgsql strtolower() in registration against missing fields.
- Scope CustomEmoji::duplicateShortcodes to the grouped column for
  Postgres GROUP BY validity.
- Remove stale Postgres guard in status:dedup; use havingRaw for
  cross-driver HAVING.
1 week ago
Your Name a424493420 Replace Str::of() fluent chains with static Str::/native calls
Aligns with the app's dominant convention (171 static Str:: calls vs
24 Str::of() chains). Uses Str::afterLast() for the repeated
"segment after last slash" pattern, Str::matchAll() where a
Collection return is needed, and native explode()/substr() where a
plain array/string suffices.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 weeks ago
Your Name 6496904293 Fix account storage limit not freeing on media deletion (#7169)
users.storage_used only ever grew: uploads incremented it but no deletion
path decremented it, so users hit the account size limit even when their
real media usage was well below it.

- Decrement storage_used in MediaDeletePipeline when media is removed
- Add UserStorageService::increaseStorageUsed / decrementStorageUsed as the
  fast, symmetric hot-path counter updates (floor-based, clamped at zero)
- Refactor the 6 upload call sites to use increaseStorageUsed instead of
  duplicated inline writes (also fixes ceil/floor drift vs the reconciler)
- Add (user_id, size) covering index so per-user SUM(size) is not a full
  table scan (INPLACE/LOCK=NONE, skipped on sqlite)
- Add user:storage:recalculate command to repair affected accounts, with a
  daily --stale=168 scheduled reconciler to correct any drift
- Add regression tests for the pipeline and UserStorageService
2 weeks ago
Your Name ec6827bae2 Check media blocklist before storing uploads to prevent orphaned files 2 weeks ago
Your Name e4e12fad7c Extract duplicated blocked-id and duplicate-shortcode query patterns
Two query patterns were copy-pasted across several call sites:

- The 'users who blocked me, plus myself' list used to filter profile
  search (UserFilter::whereFilterableId($pid)->pluck('user_id')->push($pid))
  appeared in ComposeController (x2) and DirectMessageController. Extracted
  to UserFilterService::searchExcludedProfileIds(). Note this is the
  inverse of blocks() (who I blocked), so it is a distinct method.

- CustomEmoji duplicate detection (groupBy('shortcode')->havingRaw(
  'count(*) > 1')) appeared three times in AdminController. Extracted to a
  CustomEmoji::duplicateShortcodes() query scope.

Adds tests for both. No behaviour change.
3 weeks ago
Your Name fbfd26d775 Mark direct messages read with a single bulk update
DirectMessageController@read fetched every matching DirectMessage and
saved each one individually in a loop, issuing one UPDATE per row. On an
active thread this is N queries.

Pluck the matching ids and perform a single bulk update, preserving the
existing response (the list of affected message ids) and updated_at
behaviour.

Adds regression tests covering the marked-read ids, the status_id lower
bound, and sender isolation.
3 weeks ago
Your Name b52c3d7659 perf: fix N+1 queries; fix ComposeController lint and test namespace
Performance:
- TrendingHashtagService: batch-load hashtags with whereIn/keyBy instead
  of Hashtag::find() per trending row.
- DirectMessageController: eager-load status.media and read the in-memory
  collection instead of firstMedia() issuing a query per DM message.
- GroupsSearchController: batch Profile/Follower/GroupInvitation lookups
  with whereIn instead of per-invitee queries.

Lint/tests:
- ComposeController: whitespace formatting (Pint).
- ComposeControllerTest: correct App\User to App\Models\User, fixing the
  larastan class.notFound error and import ordering.

Full suite: 547 passed. Pint and PHPStan clean.
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 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 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
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
Your Name 1a1dc5e096 fix typo 8 months ago
Daniel Supernault 86af73455f
Update DirectMessageController, add mutuals endpoint 1 year ago
Daniel Supernault 717f17cdee
Update DM config, allow new users to send DMs by default, with a new env variable to enforce a 72h limit 2 years ago
Daniel Supernault 8c7a71ee73
Update DirectMessageController, fix query 2 years ago
Daniel Supernault 4ec9f990ed
Update DirectMessageController, fix performance issue 2 years ago
Daniel Supernault 8fad89543f
DM 2 years ago
Daniel Supernault 639df41093
Update DirectMessageController, remove 72h limit for admins 2 years ago
Daniel Supernault 9eeb7b6741
Update Status caption logic, stop storing duplicate html caption in db and defer to cached StatusService rendering 2 years ago
Daniel Supernault 044d410c49
Update DirectMessageController, fix ordering bug 2 years ago
Daniel Supernault bcc8b8842f
Update DirectMessageController, fix ordering bug 2 years ago
Daniel Supernault a2524910dd
Add migration 2 years ago
Daniel Supernault bc84259a63
Lint 2 years ago
Daniel Supernault 96f24f337e
Update DirectMessageController, add carousel entity to threads 2 years ago
Daniel Supernault b24d2554a8
Update DirectMessageController, add timestamps to threads 2 years ago
Daniel Supernault 61d105fd25
Update DirectMessageController, add 72 hour delay for new accounts before they can send a DM 2 years ago
Daniel Supernault fe30cd25d1
Update DirectMessageController, add parental controls support 3 years ago
Daniel Supernault 38fee418a9
Update DirectMessageController 3 years ago
Daniel Supernault 9818656425
Update DirectMessageController, dispatch local deletes to pipeline 3 years ago
Daniel Supernault d1c297d1ad
Update DirectMessageController, revert delete delivery to sharedInbox 3 years ago
Daniel Supernault 7f462a8055
Update DirectMessageController, dispatch deliver and delete actions to the job queue 3 years ago
Daniel Supernault d848792ad4
Update DirectMessageController, deliver direct delete activities to user inbox instead of sharedInbox 3 years ago
Daniel Supernault 6cdb5bc672
Update Notification logic, remove message and rendered fields 3 years 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 9e223a6b83
Update DirectMessageController, include account entity in lookup endpoint 4 years ago
a 9e22b48a42 add back missing security context to direct messages 4 years ago
a be6dc8ac47 clean up json-ld schema 4 years ago
Daniel Supernault a4659fd2ab
Update DirectMessageController to support new Metro 2.0 UI DMs 4 years ago
Daniel Supernault f34a1e9d8e
Add Conversations model 4 years ago
Daniel Supernault bae6126db3
Update compiled assets 5 years ago
Daniel Supernault 0f00be4d98
Update DirectMessageController, fix autocomplete bug 5 years ago
Daniel Supernault 2d0a253e07
Update DirectMessageController, disable exception logging for invalid urls. Fixes #2752 5 years ago
Daniel Supernault 7895097fc1
Update config() to config_cache() 5 years ago
Daniel Supernault 3a9203e039
Update config() to config_cache() 5 years ago
Daniel Supernault c0e693cc73
Update config() to config_cache() 5 years ago