trypost/app/Models
Paulo Castellano 335180d7a1 refactor: move post-state concerns out of MediaAttacher
MediaAttacher had grown into a 180-line class with four private
methods doing different things — download, validation, storage,
and post-state mutation. Two of those (lock-and-merge into the
JSON media column, intersection of allowed media types per
platform) are post concerns, not network concerns.

Move them onto the Post model:

  Post::allowedMediaTypes(): array<Type>
      The intersection of media types accepted by every enabled
      platform. Used to be inlined as MediaAttacher::allowedMediaTypesFor.

  Post::appendMedia(array $items): void
      Lock-then-merge into the post's media[] JSON column so
      concurrent writers don't overwrite each other. Used to be
      MediaAttacher::mergeIntoPostMedia.

MediaAttacher now reads cleanly:

  attachFromUrls   — orchestrate (loop URLs, batch the appendMedia)
  attachOne        — download → validate type/size → handoff
  download         — Http::sink + progress abort, returns DTO

Drops to ~120 lines with no nested concerns. The streaming progress
abort uses the same throw-RuntimeException pattern, but now
contained in download() instead of leaking into the orchestrator.
2026-05-04 15:17:48 -03:00
..
Traits refactor: centralize media size limits in config + drop Document type 2026-05-04 14:54:47 -03:00
AccessToken.php feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
Account.php feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
AiUsageLog.php feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
Invite.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
Media.php fix: overhaul social publishing — validation, uploads, token refresh 2026-03-31 19:25:19 -03:00
Notification.php feat: notification system with SendNotification job, dialog UI, tests 2026-03-30 16:47:03 -03:00
NotificationPreference.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
Plan.php feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
Post.php refactor: move post-state concerns out of MediaAttacher 2026-05-04 15:17:48 -03:00
PostComment.php feat: add post_comments table, model, and factory 2026-04-15 20:08:16 -03:00
PostPlatform.php feat: implement paginated social accounts table with search functionality and updated UI components 2026-05-02 14:15:41 -03:00
SocialAccount.php refactor: implement lazy token refreshing and persist Mastodon scopes 2026-05-03 21:58:25 -03:00
Subscription.php feat: Implement soft deletes for workspace hashtags and labels, and integrate content_type into the initial post platforms table creation. 2026-01-17 14:44:37 -03:00
SubscriptionItem.php feat: Implement soft deletes for workspace hashtags and labels, and integrate content_type into the initial post platforms table creation. 2026-01-17 14:44:37 -03:00
User.php feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
Workspace.php feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
WorkspaceInvite.php refactor: restructure to Actions, subdomain routes (app/api), API tokens 2026-03-29 19:24:28 -03:00
WorkspaceLabel.php refactor: settings redesign, Spanish translations, language system, strict_types 2026-03-30 00:20:43 -03:00
WorkspaceSignature.php chore: remove deprecated localization files 2026-05-03 15:23:25 -03:00