Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
Add Platform::altTextMaxLength() as the alt-text cap source of truth
Paulo Castellano30a94341f9a1
diff --git a/app/Enums/SocialAccount/Platform.php b/app/Enums/SocialAccount/Platform.phpindex afcd02f33..25f2b743c 100644--- a/app/Enums/SocialAccount/Platform.php+++ b/app/Enums/SocialAccount/Platform.php@@ -127,6 +127,33 @@ enum Platform: string};}+ /**+ * Character cap the platform's API accepts for image alt text (accessibility+ * description), or null when the platform has no alt-text field. Facebook and+ * Threads document no limit, so a defensive 1000 is used. Single source of+ * truth — publishers truncate to this value, never a literal.+ */+ public function altTextMaxLength(): ?int+ {+ return match ($this) {+ self::Bluesky => 2000,+ self::X => 1000,+ self::Mastodon => 1500,+ self::LinkedIn, self::LinkedInPage => 4086,+ self::Facebook => 1000,+ self::Instagram, self::InstagramFacebook => 1000,+ self::Threads => 1000,+ self::Pinterest => 500,+ self::Discord => 1024,+ self::TikTok, self::YouTube, self::Telegram => null,+ };+ }++ public function supportsAltText(): bool+ {+ return $this->altTextMaxLength() !== null;+ }+/*** Hard cap (in characters) the platform's API will accept. Going over this* means the post can't be published. Values are the documented API maxes:diff --git a/tests/Unit/PlatformAltTextTest.php b/tests/Unit/PlatformAltTextTest.phpnew file mode 100644index 000000000..c57779035--- /dev/null+++ b/tests/Unit/PlatformAltTextTest.php@@ -0,0 +1,28 @@+<?php++declare(strict_types=1);++use App\Enums\SocialAccount\Platform;++test('altTextMaxLength returns the documented cap for supporting platforms', function () {+ expect(Platform::Bluesky->altTextMaxLength())->toBe(2000)+ ->and(Platform::X->altTextMaxLength())->toBe(1000)+ ->and(Platform::Mastodon->altTextMaxLength())->toBe(1500)+ ->and(Platform::LinkedIn->altTextMaxLength())->toBe(4086)+ ->and(Platform::Instagram->altTextMaxLength())->toBe(1000)+ ->and(Platform::Pinterest->altTextMaxLength())->toBe(500)+ ->and(Platform::Discord->altTextMaxLength())->toBe(1024)+ ->and(Platform::Facebook->altTextMaxLength())->toBe(1000)+ ->and(Platform::Threads->altTextMaxLength())->toBe(1000);+});++test('altTextMaxLength is null for platforms without alt-text support', function () {+ expect(Platform::TikTok->altTextMaxLength())->toBeNull()+ ->and(Platform::Telegram->altTextMaxLength())->toBeNull()+ ->and(Platform::YouTube->altTextMaxLength())->toBeNull();+});++test('supportsAltText mirrors altTextMaxLength', function () {+ expect(Platform::Bluesky->supportsAltText())->toBeTrue()+ ->and(Platform::TikTok->supportsAltText())->toBeFalse();+});