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 optional Pinterest pin title and destination link (#232)
Paulo Castellano2248d01edc90
diff --git a/app/Actions/Post/CreatePost.php b/app/Actions/Post/CreatePost.phpindex 2cda0693c..a0f439e89 100644--- a/app/Actions/Post/CreatePost.php+++ b/app/Actions/Post/CreatePost.php@@ -74,7 +74,10 @@ class CreatePost->first();if ($existing) {- $updates['meta'] = array_merge($existing->meta ?? [], $meta);+ $updates['meta'] = array_filter(+ array_merge($existing->meta ?? [], $meta),+ fn (mixed $value): bool => $value !== null,+ );}}diff --git a/app/Actions/Post/UpdatePost.php b/app/Actions/Post/UpdatePost.phpindex 45a694ab8..7bb2fac1e 100644--- a/app/Actions/Post/UpdatePost.php+++ b/app/Actions/Post/UpdatePost.php@@ -58,7 +58,10 @@ class UpdatePost$postPlatform = $post->postPlatforms()->where('id', data_get($platformData, 'id'))->first();if ($postPlatform) {- $updateData['meta'] = array_merge($postPlatform->meta ?? [], data_get($platformData, 'meta'));+ $updateData['meta'] = array_filter(+ array_merge($postPlatform->meta ?? [], data_get($platformData, 'meta') ?? []),+ fn (mixed $value): bool => $value !== null,+ );}}diff --git a/app/Http/Requests/Api/Post/StorePostRequest.php b/app/Http/Requests/Api/Post/StorePostRequest.phpindex 00b98f24f..8f19cb3ba 100644--- a/app/Http/Requests/Api/Post/StorePostRequest.php+++ b/app/Http/Requests/Api/Post/StorePostRequest.php@@ -61,6 +61,22 @@ class StorePostRequest extends FormRequest];}+ /**+ * @return array<string, string>+ */+ public function messages(): array+ {+ return PostPlatformMetaRules::messages();+ }++ /**+ * @return array<string, string>+ */+ public function attributes(): array+ {+ return PostPlatformMetaRules::attributes();+ }+/*** @return Collection<int, Platform>*/diff --git a/app/Http/Requests/Api/Post/UpdatePostRequest.php b/app/Http/Requests/Api/Post/UpdatePostRequest.phpindex 79bfa5f5f..2796b80f4 100644--- a/app/Http/Requests/Api/Post/UpdatePostRequest.php+++ b/app/Http/Requests/Api/Post/UpdatePostRequest.php@@ -64,6 +64,22 @@ class UpdatePostRequest extends FormRequest];}+ /**+ * @return array<string, string>+ */+ public function messages(): array+ {+ return PostPlatformMetaRules::messages();+ }++ /**+ * @return array<string, string>+ */+ public function attributes(): array+ {+ return PostPlatformMetaRules::attributes();+ }+public function withValidator(Validator $validator): void{$validator->after(function (Validator $validator): void {diff --git a/app/Http/Requests/App/Post/UpdatePostRequest.php b/app/Http/Requests/App/Post/UpdatePostRequest.phpindex 6aed0fab8..83647284d 100644--- a/app/Http/Requests/App/Post/UpdatePostRequest.php+++ b/app/Http/Requests/App/Post/UpdatePostRequest.php@@ -61,6 +61,22 @@ class UpdatePostRequest extends FormRequest];}+ /**+ * @return array<string, string>+ */+ public function messages(): array+ {+ return PostPlatformMetaRules::messages();+ }++ /**+ * @return array<string, string>+ */+ public function attributes(): array+ {+ return PostPlatformMetaRules::attributes();+ }+public function withValidator(Validator $validator): void{$validator->after(function (Validator $validator): void {diff --git a/app/Mcp/Tools/Post/CreatePostTool.php b/app/Mcp/Tools/Post/CreatePostTool.phpindex 95258218c..933f1380b 100644--- a/app/Mcp/Tools/Post/CreatePostTool.php+++ b/app/Mcp/Tools/Post/CreatePostTool.php@@ -25,22 +25,26 @@ class CreatePostTool extends Tool{$workspace = $request->user()->currentWorkspace;- $validated = $request->validate([- 'content' => ['nullable', 'string', 'max:10000'],- 'scheduled_at' => ['nullable', 'date', 'after:now'],- 'label_ids' => ['sometimes', 'array'],- 'label_ids.*' => ['uuid', Rule::exists('workspace_labels', 'id')->where('workspace_id', $workspace->id)],- 'platforms' => ['sometimes', 'array'],- 'platforms.*.social_account_id' => [- 'required',- 'uuid',- Rule::exists('social_accounts', 'id')- ->where('workspace_id', $workspace->id)- ->where('is_active', true),+ $validated = $request->validate(+ [+ 'content' => ['nullable', 'string', 'max:10000'],+ 'scheduled_at' => ['nullable', 'date', 'after:now'],+ 'label_ids' => ['sometimes', 'array'],+ 'label_ids.*' => ['uuid', Rule::exists('workspace_labels', 'id')->where('workspace_id', $workspace->id)],+ 'platforms' => ['sometimes', 'array'],+ 'platforms.*.social_account_id' => [+ 'required',+ 'uuid',+ Rule::exists('social_accounts', 'id')+ ->where('workspace_id', $workspace->id)+ ->where('is_active', true),+ ],+ 'platforms.*.content_type' => ['required', 'string', Rule::in(array_column(ContentType::cases(), 'value')), new ContentTypeMatchesPlatform],+ ...PostPlatformMetaRules::rules(),],- 'platforms.*.content_type' => ['required', 'string', Rule::in(array_column(ContentType::cases(), 'value')), new ContentTypeMatchesPlatform],- ...PostPlatformMetaRules::rules(),- ]);+ PostPlatformMetaRules::messages(),+ PostPlatformMetaRules::attributes(),+ );$validated['created_via'] = CreatedVia::Mcp;@@ -63,7 +67,7 @@ class CreatePostTool extends Tool->items($schema->object(fn ($p) => ['social_account_id' => $p->string()->required()->description('UUID of the connected social account.'),'content_type' => $p->string()->required()->description('Format for this platform (e.g. linkedin_post, x_post, instagram_feed).'),- 'meta' => $p->object()->description('Per-platform metadata. Instagram/Facebook: aspect_ratio (1:1|4:5|16:9|original). TikTok: privacy_level (required to publish) + flags (allow_comments, allow_duet, allow_stitch, disclose, brand_content_toggle, brand_organic_toggle, is_aigc, auto_add_music). Pinterest: board_id (required to publish — call ListPinterestBoardsTool first). Discord: channel_id (required to publish — call ListDiscordChannelsTool first), mentions ([{token,label}]), embeds ([{title,description,url,image,color}]).'),+ 'meta' => $p->object()->description('Per-platform metadata. Instagram/Facebook: aspect_ratio (1:1|4:5|16:9|original). TikTok: privacy_level (required to publish) + flags (allow_comments, allow_duet, allow_stitch, disclose, brand_content_toggle, brand_organic_toggle, is_aigc, auto_add_music). Pinterest: board_id (required to publish — call ListPinterestBoardsTool first), title (≤100), link (destination URL). Pin description comes from the post content. Discord: channel_id (required to publish — call ListDiscordChannelsTool first), mentions ([{token,label}]), embeds ([{title,description,url,image,color}]).'),]))->description('Platforms to publish on. Accounts not listed remain available but disabled.'),];diff --git a/app/Mcp/Tools/Post/UpdatePostTool.php b/app/Mcp/Tools/Post/UpdatePostTool.phpindex 9e1d5d436..19eb5b001 100644--- a/app/Mcp/Tools/Post/UpdatePostTool.php+++ b/app/Mcp/Tools/Post/UpdatePostTool.php@@ -39,27 +39,31 @@ class UpdatePostTool extends Tool$status = data_get($request->all(), 'status');- $validated = $request->validate([- 'post_id' => ['required', 'uuid'],- 'content' => ['nullable', 'string', 'max:10000'],- 'scheduled_at' => PostStatusRules::scheduledAtRules($post, $status),- 'status' => ['sometimes', 'string', Rule::in([Status::Draft->value, Status::Scheduled->value])],- 'label_ids' => ['sometimes', 'array'],- 'label_ids.*' => ['uuid', Rule::exists('workspace_labels', 'id')->where('workspace_id', $workspace->id)],- 'platforms' => ['sometimes', 'array'],- 'platforms.*.id' => [- 'required',- 'uuid',- Rule::exists('post_platforms', 'id')->where('post_id', $post->id),+ $validated = $request->validate(+ [+ 'post_id' => ['required', 'uuid'],+ 'content' => ['nullable', 'string', 'max:10000'],+ 'scheduled_at' => PostStatusRules::scheduledAtRules($post, $status),+ 'status' => ['sometimes', 'string', Rule::in([Status::Draft->value, Status::Scheduled->value])],+ 'label_ids' => ['sometimes', 'array'],+ 'label_ids.*' => ['uuid', Rule::exists('workspace_labels', 'id')->where('workspace_id', $workspace->id)],+ 'platforms' => ['sometimes', 'array'],+ 'platforms.*.id' => [+ 'required',+ 'uuid',+ Rule::exists('post_platforms', 'id')->where('post_id', $post->id),+ ],+ 'platforms.*.content_type' => [+ 'sometimes',+ 'string',+ Rule::in(array_column(ContentType::cases(), 'value')),+ new ContentTypeMatchesPostPlatform,+ ],+ ...PostPlatformMetaRules::rules(),],- 'platforms.*.content_type' => [- 'sometimes',- 'string',- Rule::in(array_column(ContentType::cases(), 'value')),- new ContentTypeMatchesPostPlatform,- ],- ...PostPlatformMetaRules::rules(),- ]);+ PostPlatformMetaRules::messages(),+ PostPlatformMetaRules::attributes(),+ );// On schedule, validate each platform's effective content_type (resubmitted// here, or stored) against the post's stored media — the tool can't change@@ -107,7 +111,7 @@ class UpdatePostTool extends Tool->items($schema->object(fn ($p) => ['id' => $p->string()->required()->description('UUID of the post_platform row (from get-post-tool / list-posts-tool).'),'content_type' => $p->string()->description('New content_type for this platform.'),- 'meta' => $p->object()->description('Per-platform metadata override. Instagram/Facebook: aspect_ratio. TikTok: privacy_level (required to publish) + flags. Pinterest: board_id (required to publish — call ListPinterestBoardsTool first). Discord: channel_id (required to publish — call ListDiscordChannelsTool first), mentions, embeds. Merged with existing meta.'),+ 'meta' => $p->object()->description('Per-platform metadata override. Instagram/Facebook: aspect_ratio. TikTok: privacy_level (required to publish) + flags. Pinterest: board_id (required to publish — call ListPinterestBoardsTool first), title (≤100), link (destination URL). Pin description comes from the post content. Discord: channel_id (required to publish — call ListDiscordChannelsTool first), mentions, embeds. Merged with existing meta.'),]))->description('Platforms to enable for publishing. Any platform NOT listed will be disabled. Pass an empty array to disable all.'),];diff --git a/app/Services/Social/PinterestPublisher.php b/app/Services/Social/PinterestPublisher.phpindex 87dfb1d5c..ecdbaabc6 100644--- a/app/Services/Social/PinterestPublisher.php+++ b/app/Services/Social/PinterestPublisher.php@@ -38,7 +38,9 @@ class PinterestPublisherapp(ConnectionVerifier::class)->refreshToken($account);}- $content = $postPlatform->post->content ? app(ContentSanitizer::class)->sanitize($postPlatform->post->content, $postPlatform->platform) : null;+ $content = $postPlatform->post->content+ ? app(ContentSanitizer::class)->sanitize($postPlatform->post->content, $postPlatform->platform)+ : null;return match ($postPlatform->content_type) {ContentType::PinterestPin => $this->publishImagePin($postPlatform, $content),@@ -51,6 +53,69 @@ class PinterestPublisher};}+ /**+ * Apply pin description from the shared post caption, plus optional title/link from meta.+ *+ * @param array<string, mixed> $payload+ * @return array<string, mixed>+ */+ private function applyPinTextFields(array $payload, PostPlatform $postPlatform, ?string $content): array+ {+ if (filled($content)) {+ $payload['description'] = mb_substr($content, 0, 800);+ }++ if (filled(data_get($postPlatform->meta, 'title'))) {+ $payload['title'] = mb_substr((string) data_get($postPlatform->meta, 'title'), 0, 100);+ }++ if (filled(data_get($postPlatform->meta, 'link'))) {+ $payload['link'] = data_get($postPlatform->meta, 'link');+ }++ return $payload;+ }++ private function resolveBoardId(PostPlatform $postPlatform): string+ {+ $boardId = data_get($postPlatform->meta, 'board_id')+ ?? data_get($postPlatform->socialAccount->meta, 'default_board_id');++ if (! filled($boardId)) {+ throw new PinterestPublishException(+ userMessage: 'Pinterest board_id is required',+ category: ErrorCategory::ContentPolicy,+ );+ }++ return (string) $boardId;+ }++ /**+ * @param array<string, mixed> $payload+ * @return array{id: mixed, url: string}+ */+ private function createPin(SocialAccount $account, array $payload, string $failureLogMessage): array+ {+ $response = $this->socialHttp()->withToken($account->access_token)+ ->post($this->baseUrl.'/pins', $payload);++ if ($response->failed()) {+ Log::error($failureLogMessage, [+ 'status' => $response->status(),+ 'body' => $this->redactResponseBody($response->body()),+ ]);+ $this->handleApiError($response);+ }++ $pinId = data_get($response->json(), 'id');++ return [+ 'id' => $pinId,+ 'url' => "https://pinterest.com/pin/{$pinId}",+ ];+ }+private function publishImagePin(PostPlatform $postPlatform, ?string $content): array{$account = $postPlatform->socialAccount;@@ -63,14 +128,7 @@ class PinterestPublisher);}- $boardId = data_get($postPlatform->meta, 'board_id') ?? data_get($account->meta, 'default_board_id') ?? null;-- if (! $boardId) {- throw new PinterestPublishException(- userMessage: 'Pinterest board_id is required',- category: ErrorCategory::ContentPolicy,- );- }+ $boardId = $this->resolveBoardId($postPlatform);// Download and optimize image$tempFile = tempnam(sys_get_temp_dir(), 'pin_image_');@@ -98,26 +156,14 @@ class PinterestPublisher@unlink($tempFile);}- $payload = [+ $payload = $this->applyPinTextFields(['board_id' => $boardId,'media_source' => ['source_type' => 'image_base64','content_type' => 'image/jpeg','data' => $imageBase64,],- ];-- if ($content) {- $payload['description'] = $content;- }-- if (! empty(data_get($postPlatform->meta, 'title'))) {- $payload['title'] = substr(data_get($postPlatform->meta, 'title'), 0, 100);- }-- if (! empty(data_get($postPlatform->meta, 'link'))) {- $payload['link'] = data_get($postPlatform->meta, 'link');- }+ ], $postPlatform, $content);$alt = $postPlatform->post->mediaItems->first(fn ($m) => $m->isImage())?->altTextFor(Platform::Pinterest);@@ -125,23 +171,7 @@ class PinterestPublisher$payload['alt_text'] = $alt;}- $response = $this->socialHttp()->withToken($account->access_token)- ->post($this->baseUrl.'/pins', $payload);-- if ($response->failed()) {- Log::error('Pinterest pin creation failed', [- 'status' => $response->status(),- 'body' => $this->redactResponseBody($response->body()),- ]);- $this->handleApiError($response);- }-- $data = $response->json();-- return [- 'id' => data_get($data, 'id'),- 'url' => 'https://pinterest.com/pin/'.data_get($data, 'id'),- ];+ return $this->createPin($account, $payload, 'Pinterest pin creation failed');}private function publishVideoPin(PostPlatform $postPlatform, ?string $content): array@@ -156,14 +186,7 @@ class PinterestPublisher);}- $boardId = data_get($postPlatform->meta, 'board_id') ?? data_get($account->meta, 'default_board_id') ?? null;-- if (! $boardId) {- throw new PinterestPublishException(- userMessage: 'Pinterest board_id is required',- category: ErrorCategory::ContentPolicy,- );- }+ $boardId = $this->resolveBoardId($postPlatform);// Step 1: Register media upload$registerResponse = $this->socialHttp()->withToken($account->access_token)@@ -253,25 +276,13 @@ class PinterestPublisher$this->waitForMediaProcessing($account, $mediaId);// Step 4: Create pin with video- $payload = [+ $payload = $this->applyPinTextFields(['board_id' => $boardId,'media_source' => ['source_type' => 'video_id','media_id' => $mediaId,],- ];-- if ($content) {- $payload['description'] = $content;- }-- if (! empty(data_get($postPlatform->meta, 'title'))) {- $payload['title'] = substr(data_get($postPlatform->meta, 'title'), 0, 100);- }-- if (! empty(data_get($postPlatform->meta, 'link'))) {- $payload['link'] = data_get($postPlatform->meta, 'link');- }+ ], $postPlatform, $content);if (! empty(data_get($postPlatform->meta, 'cover_image_url'))) {$payload['media_source']['cover_image_url'] = data_get($postPlatform->meta, 'cover_image_url');@@ -279,23 +290,7 @@ class PinterestPublisher$payload['media_source']['cover_image_key_frame_time'] = 0;}- $response = $this->socialHttp()->withToken($account->access_token)- ->post($this->baseUrl.'/pins', $payload);-- if ($response->failed()) {- Log::error('Pinterest video pin creation failed', [- 'status' => $response->status(),- 'body' => $this->redactResponseBody($response->body()),- ]);- $this->handleApiError($response);- }-- $data = $response->json();-- return [- 'id' => data_get($data, 'id'),- 'url' => 'https://pinterest.com/pin/'.data_get($data, 'id'),- ];+ return $this->createPin($account, $payload, 'Pinterest video pin creation failed');}private function publishCarousel(PostPlatform $postPlatform, ?string $content): array@@ -310,56 +305,19 @@ class PinterestPublisher);}- $boardId = data_get($postPlatform->meta, 'board_id') ?? data_get($account->meta, 'default_board_id') ?? null;-- if (! $boardId) {- throw new PinterestPublishException(- userMessage: 'Pinterest board_id is required',- category: ErrorCategory::ContentPolicy,- );- }-$items = $medias->map(fn ($media) => ['url' => $media->url,])->toArray();- $payload = [- 'board_id' => $boardId,+ $payload = $this->applyPinTextFields([+ 'board_id' => $this->resolveBoardId($postPlatform),'media_source' => ['source_type' => 'multiple_image_urls','items' => $items,],- ];-- if ($content) {- $payload['description'] = $content;- }-- if (! empty(data_get($postPlatform->meta, 'title'))) {- $payload['title'] = substr(data_get($postPlatform->meta, 'title'), 0, 100);- }+ ], $postPlatform, $content);- if (! empty(data_get($postPlatform->meta, 'link'))) {- $payload['link'] = data_get($postPlatform->meta, 'link');- }-- $response = $this->socialHttp()->withToken($account->access_token)- ->post($this->baseUrl.'/pins', $payload);-- if ($response->failed()) {- Log::error('Pinterest carousel creation failed', [- 'status' => $response->status(),- 'body' => $this->redactResponseBody($response->body()),- ]);- $this->handleApiError($response);- }-- $data = $response->json();-- return [- 'id' => data_get($data, 'id'),- 'url' => 'https://pinterest.com/pin/'.data_get($data, 'id'),- ];+ return $this->createPin($account, $payload, 'Pinterest carousel creation failed');}private function waitForMediaProcessing(SocialAccount $account, string $mediaId, int $maxAttempts = 30): voiddiff --git a/app/Support/PostPlatformMetaRules.php b/app/Support/PostPlatformMetaRules.phpindex 00f6d7b2b..cfb57b80d 100644--- a/app/Support/PostPlatformMetaRules.php+++ b/app/Support/PostPlatformMetaRules.php@@ -61,6 +61,8 @@ class PostPlatformMetaRules'platforms.*.meta.board_id' => ['sometimes', 'nullable', 'string'],+ 'platforms.*.meta.title' => ['sometimes', 'nullable', 'string', 'max:100'],+ 'platforms.*.meta.link' => ['sometimes', 'nullable', 'url:http,https', 'max:2048'],// Discord'platforms.*.meta.channel_id' => ['sometimes', 'nullable', 'string'],@@ -77,6 +79,33 @@ class PostPlatformMetaRules];}+ /**+ * Custom validation messages for meta fields shown in the UI.+ *+ * @return array<string, string>+ */+ public static function messages(): array+ {+ return [+ 'platforms.*.meta.link.url' => __('posts.form.pinterest.link_invalid'),+ 'platforms.*.meta.link.max' => __('posts.form.pinterest.link_max'),+ 'platforms.*.meta.title.max' => __('posts.form.pinterest.title_max'),+ ];+ }++ /**+ * Friendly attribute names so default messages never expose `platforms.0.meta.*`.+ *+ * @return array<string, string>+ */+ public static function attributes(): array+ {+ return [+ 'platforms.*.meta.title' => __('posts.form.pinterest.title'),+ 'platforms.*.meta.link' => __('posts.form.pinterest.link'),+ ];+ }+/*** Adds validation errors for per-platform meta that becomes mandatory once a* post is published or scheduled (TikTok privacy, Pinterest board, Discorddiff --git a/lang/ar/posts.php b/lang/ar/posts.phpindex 3f3b800f6..5bc649b3d 100644--- a/lang/ar/posts.php+++ b/lang/ar/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'البحث في اللوحات...','no_board_found' => 'لا توجد لوحة مطابقة لبحثك.','board_required' => 'اختر لوحة Pinterest لنشر هذا المنشور.',+ 'title' => 'العنوان',+ 'title_placeholder' => 'عنوان اختياري للدبوس',+ 'link' => 'رابط الوجهة',+ 'link_placeholder' => 'https://example.com',+ 'link_invalid' => 'أدخل رابط وجهة صالحًا (http أو https).',+ 'title_max' => 'يجب ألا يتجاوز العنوان 100 حرفًا.',+ 'link_max' => 'يجب ألا يتجاوز رابط الوجهة 2048 حرفًا.',],'discord' => ['settings' => 'إعدادات Discord',diff --git a/lang/de/posts.php b/lang/de/posts.phpindex de87cbeda..4445d1392 100644--- a/lang/de/posts.php+++ b/lang/de/posts.php@@ -160,6 +160,13 @@ return ['search_board' => 'Pinnwände suchen...','no_board_found' => 'Keine Pinnwand passt zu deiner Suche.','board_required' => 'Wähle eine Pinterest-Pinnwand, um diesen Beitrag zu veröffentlichen.',+ 'title' => 'Titel',+ 'title_placeholder' => 'Optionaler Pin-Titel',+ 'link' => 'Ziel-Link',+ 'link_placeholder' => 'https://beispiel.com',+ 'link_invalid' => 'Gib einen gültigen Ziel-Link ein (http oder https).',+ 'title_max' => 'Der Titel darf höchstens 100 Zeichen lang sein.',+ 'link_max' => 'Der Ziel-Link darf höchstens 2048 Zeichen lang sein.',],'discord' => ['settings' => 'Discord-Einstellungen',diff --git a/lang/el/posts.php b/lang/el/posts.phpindex 03e36c604..1f2edd343 100644--- a/lang/el/posts.php+++ b/lang/el/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Αναζήτηση πινάκων...','no_board_found' => 'Κανένας πίνακας δεν ταιριάζει με την αναζήτησή σας.','board_required' => 'Επιλέξτε έναν πίνακα Pinterest για να δημοσιεύσετε αυτή τη δημοσίευση.',+ 'title' => 'Τίτλος',+ 'title_placeholder' => 'Προαιρετικός τίτλος pin',+ 'link' => 'Σύνδεσμος προορισμού',+ 'link_placeholder' => 'https://example.com',+ 'link_invalid' => 'Εισαγάγετε έναν έγκυρο σύνδεσμο προορισμού (http ή https).',+ 'title_max' => 'Ο τίτλος δεν μπορεί να υπερβαίνει τους 100 χαρακτήρες.',+ 'link_max' => 'Ο σύνδεσμος προορισμού δεν μπορεί να υπερβαίνει τους 2048 χαρακτήρες.',],'discord' => ['settings' => 'Ρυθμίσεις Discord',diff --git a/lang/en/posts.php b/lang/en/posts.phpindex 8878a7078..918c0c299 100644--- a/lang/en/posts.php+++ b/lang/en/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Search boards...','no_board_found' => 'No board matches your search.','board_required' => 'Select a Pinterest board to publish this post.',+ 'title' => 'Title',+ 'title_placeholder' => 'Optional pin title',+ 'link' => 'Destination link',+ 'link_placeholder' => 'https://example.com',+ 'link_invalid' => 'Enter a valid destination link (http or https).',+ 'title_max' => 'Title may not be longer than 100 characters.',+ 'link_max' => 'Destination link may not be longer than 2048 characters.',],'discord' => ['settings' => 'Discord Settings',diff --git a/lang/es/posts.php b/lang/es/posts.phpindex 9e00e3253..a2d8110bd 100644--- a/lang/es/posts.php+++ b/lang/es/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Buscar tableros...','no_board_found' => 'Ningún tablero coincide con tu búsqueda.','board_required' => 'Selecciona un tablero de Pinterest para publicar este post.',+ 'title' => 'Título',+ 'title_placeholder' => 'Título opcional del pin',+ 'link' => 'Enlace de destino',+ 'link_placeholder' => 'https://ejemplo.com',+ 'link_invalid' => 'Introduce un enlace de destino válido (http o https).',+ 'title_max' => 'El título no puede tener más de 100 caracteres.',+ 'link_max' => 'El enlace de destino no puede tener más de 2048 caracteres.',],'discord' => ['settings' => 'Configuración de Discord',diff --git a/lang/fr/posts.php b/lang/fr/posts.phpindex 79630288e..6e7ffc3ba 100644--- a/lang/fr/posts.php+++ b/lang/fr/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Rechercher des tableaux...','no_board_found' => 'Aucun tableau ne correspond à votre recherche.','board_required' => 'Sélectionnez un tableau Pinterest pour publier cette publication.',+ 'title' => 'Titre',+ 'title_placeholder' => 'Titre optionnel de l’épingle',+ 'link' => 'Lien de destination',+ 'link_placeholder' => 'https://exemple.com',+ 'link_invalid' => 'Saisissez un lien de destination valide (http ou https).',+ 'title_max' => 'Le titre ne peut pas dépasser 100 caractères.',+ 'link_max' => 'Le lien de destination ne peut pas dépasser 2048 caractères.',],'discord' => ['settings' => 'Paramètres Discord',diff --git a/lang/it/posts.php b/lang/it/posts.phpindex 3f0d43e0e..4d08795fc 100644--- a/lang/it/posts.php+++ b/lang/it/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Cerca bacheche...','no_board_found' => 'Nessuna bacheca corrisponde alla ricerca.','board_required' => 'Seleziona una bacheca Pinterest per pubblicare questo post.',+ 'title' => 'Titolo',+ 'title_placeholder' => 'Titolo opzionale del pin',+ 'link' => 'Link di destinazione',+ 'link_placeholder' => 'https://esempio.com',+ 'link_invalid' => 'Inserisci un link di destinazione valido (http o https).',+ 'title_max' => 'Il titolo non può superare i 100 caratteri.',+ 'link_max' => 'Il link di destinazione non può superare i 2048 caratteri.',],'discord' => ['settings' => 'Impostazioni Discord',diff --git a/lang/ja/posts.php b/lang/ja/posts.phpindex 53cc227a4..1af1a4431 100644--- a/lang/ja/posts.php+++ b/lang/ja/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'ボードを検索...','no_board_found' => '検索に一致するボードがありません。','board_required' => 'この投稿を公開する Pinterest ボードを選択してください。',+ 'title' => 'タイトル',+ 'title_placeholder' => '任意のピンタイトル',+ 'link' => 'リンク先',+ 'link_placeholder' => 'https://example.com',+ 'link_invalid' => '有効なリンク先URLを入力してください(http または https)。',+ 'title_max' => 'タイトルは100文字以内にしてください。',+ 'link_max' => 'リンク先URLは2048文字以内にしてください。',],'discord' => ['settings' => 'Discord 設定',diff --git a/lang/ko/posts.php b/lang/ko/posts.phpindex 8bb2ae08e..bd8c1ab98 100644--- a/lang/ko/posts.php+++ b/lang/ko/posts.php@@ -158,6 +158,13 @@ return ['search_board' => '보드 검색...','no_board_found' => '검색과 일치하는 보드가 없습니다.','board_required' => '이 게시물을 게시할 Pinterest 보드를 선택하세요.',+ 'title' => '제목',+ 'title_placeholder' => '선택적 핀 제목',+ 'link' => '도착 링크',+ 'link_placeholder' => 'https://example.com',+ 'link_invalid' => '유효한 목적지 링크를 입력하세요(http 또는 https).',+ 'title_max' => '제목은 100자를 초과할 수 없습니다.',+ 'link_max' => '목적지 링크는 2048자를 초과할 수 없습니다.',],'discord' => ['settings' => 'Discord 설정',diff --git a/lang/nl/posts.php b/lang/nl/posts.phpindex eaa2335da..9a83be401 100644--- a/lang/nl/posts.php+++ b/lang/nl/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Borden zoeken...','no_board_found' => 'Geen bord komt overeen met je zoekopdracht.','board_required' => 'Selecteer een Pinterest-bord om deze post te publiceren.',+ 'title' => 'Titel',+ 'title_placeholder' => 'Optionele pin-titel',+ 'link' => 'Bestemmingslink',+ 'link_placeholder' => 'https://voorbeeld.com',+ 'link_invalid' => 'Voer een geldige bestemmingslink in (http of https).',+ 'title_max' => 'Titel mag niet langer zijn dan 100 tekens.',+ 'link_max' => 'Bestemmingslink mag niet langer zijn dan 2048 tekens.',],'discord' => ['settings' => 'Discord-instellingen',diff --git a/lang/pl/posts.php b/lang/pl/posts.phpindex 74271f4ab..c040718f7 100644--- a/lang/pl/posts.php+++ b/lang/pl/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Szukaj tablic...','no_board_found' => 'Brak tablic pasujących do wyszukiwania.','board_required' => 'Wybierz tablicę Pinterest, aby opublikować ten post.',+ 'title' => 'Tytuł',+ 'title_placeholder' => 'Opcjonalny tytuł pina',+ 'link' => 'Link docelowy',+ 'link_placeholder' => 'https://przyklad.com',+ 'link_invalid' => 'Podaj prawidłowy link docelowy (http lub https).',+ 'title_max' => 'Tytuł nie może być dłuższy niż 100 znaków.',+ 'link_max' => 'Link docelowy nie może być dłuższy niż 2048 znaków.',],'discord' => ['settings' => 'Ustawienia Discord',diff --git a/lang/pt-BR/posts.php b/lang/pt-BR/posts.phpindex 8d40e9611..10ccc0fe8 100644--- a/lang/pt-BR/posts.php+++ b/lang/pt-BR/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Pesquisar quadros...','no_board_found' => 'Nenhum quadro encontrado.','board_required' => 'Selecione um quadro do Pinterest para publicar este post.',+ 'title' => 'Título',+ 'title_placeholder' => 'Título opcional do pin',+ 'link' => 'Link de destino',+ 'link_placeholder' => 'https://exemplo.com',+ 'link_invalid' => 'Informe um link de destino válido (http ou https).',+ 'title_max' => 'O título pode ter no máximo 100 caracteres.',+ 'link_max' => 'O link de destino pode ter no máximo 2048 caracteres.',],'discord' => ['settings' => 'Configurações do Discord',diff --git a/lang/ru/posts.php b/lang/ru/posts.phpindex a2efc84e5..3c83c63e6 100644--- a/lang/ru/posts.php+++ b/lang/ru/posts.php@@ -158,6 +158,13 @@ return ['search_board' => 'Поиск досок...','no_board_found' => 'Нет досок по вашему запросу.','board_required' => 'Выберите доску Pinterest, чтобы опубликовать этот пост.',+ 'title' => 'Заголовок',+ 'title_placeholder' => 'Необязательный заголовок пина',+ 'link' => 'Ссылка назначения',+ 'link_placeholder' => 'https://example.com',+ 'link_invalid' => 'Укажите корректную ссылку назначения (http или https).',+ 'title_max' => 'Заголовок не может быть длиннее 100 символов.',+ 'link_max' => 'Ссылка назначения не может быть длиннее 2048 символов.',],'discord' => ['settings' => 'Настройки Discord',diff --git a/lang/tr/posts.php b/lang/tr/posts.phpindex a70247885..22e9f3e95 100644--- a/lang/tr/posts.php+++ b/lang/tr/posts.php@@ -160,6 +160,13 @@ return ['search_board' => 'Pano ara...','no_board_found' => 'Aramanızla eşleşen pano yok.','board_required' => 'Bu gönderiyi yayınlamak için bir Pinterest panosu seçin.',+ 'title' => 'Başlık',+ 'title_placeholder' => 'İsteğe bağlı pin başlığı',+ 'link' => 'Hedef bağlantı',+ 'link_placeholder' => 'https://ornek.com',+ 'link_invalid' => 'Geçerli bir hedef bağlantısı girin (http veya https).',+ 'title_max' => 'Başlık en fazla 100 karakter olabilir.',+ 'link_max' => 'Hedef bağlantısı en fazla 2048 karakter olabilir.',],'discord' => ['settings' => 'Discord Ayarları',diff --git a/lang/zh/posts.php b/lang/zh/posts.phpindex 9cf3a6a71..4f281001c 100644--- a/lang/zh/posts.php+++ b/lang/zh/posts.php@@ -158,6 +158,13 @@ return ['search_board' => '搜索图板…','no_board_found' => '没有与搜索匹配的图板。','board_required' => '请选择一个 Pinterest 图板以发布此帖子。',+ 'title' => '标题',+ 'title_placeholder' => '可选的 Pin 标题',+ 'link' => '目标链接',+ 'link_placeholder' => 'https://example.com',+ 'link_invalid' => '请输入有效的目标链接(http 或 https)。',+ 'title_max' => '标题不能超过 100 个字符。',+ 'link_max' => '目标链接不能超过 2048 个字符。',],'discord' => ['settings' => 'Discord 设置',diff --git a/resources/js/components/posts/editor/PinterestSettings.vue b/resources/js/components/posts/editor/PinterestSettings.vueindex e3c6c78a9..dfd8d8ce2 100644--- a/resources/js/components/posts/editor/PinterestSettings.vue+++ b/resources/js/components/posts/editor/PinterestSettings.vue@@ -14,6 +14,7 @@ import {ComboboxList,ComboboxTrigger,} from '@/components/ui/combobox';+import { Input } from '@/components/ui/input';import { getMediaValidationWarning } from '@/composables/useMedia';import { usePageErrors } from '@/composables/usePageErrors';import { getPlatformLogo } from '@/composables/usePlatformLogo';@@ -95,15 +96,39 @@ const selectedBoard = computed<BoardOption | undefined>({set: (board) => emit('update:meta', { ...props.meta, board_id: board?.value ?? null }),});-// Surface the backend validation error keyed by platform index-// (`platforms.0.meta.board_id`). Suffix match avoids threading the index-// through props. Cleared as soon as a board is picked locally so the user-// doesn't see a stale error after fixing the issue.+const pinTitle = computed({+ get: () => (props.meta?.title as string | undefined) || '',+ set: (value: string) => {+ // Whitespace-only clears the field; keep interior spaces while typing.+ emit('update:meta', { ...props.meta, title: value.trim() === '' ? null : value });+ },+});++const pinLink = computed({+ get: () => (props.meta?.link as string | undefined) || '',+ set: (value: string) => {+ // Whitespace-only clears the field; keep partial URLs while typing.+ emit('update:meta', { ...props.meta, link: value.trim() === '' ? null : value });+ },+});++// Surface backend validation errors keyed by platform index+// (`platforms.0.meta.*`). Suffix match avoids threading the index through props.+// Board clears as soon as one is picked so the user doesn't see a stale error.const errors = usePageErrors();const boardError = computed<string | undefined>(() => {- if (props.meta?.board_id) return undefined;+ if (props.meta?.board_id) {+ return undefined;+ }+return Object.entries(errors.value).find(([key]) => key.endsWith('.meta.board_id'))?.[1];});+const titleError = computed<string | undefined>(() => {+ return Object.entries(errors.value).find(([key]) => key.endsWith('.meta.title'))?.[1];+});+const linkError = computed<string | undefined>(() => {+ return Object.entries(errors.value).find(([key]) => key.endsWith('.meta.link'))?.[1];+});</script><template>@@ -214,6 +239,30 @@ const boardError = computed<string | undefined>(() => {</template></div>+ <div class="space-y-2">+ <p class="text-[11px] font-black uppercase tracking-widest text-foreground/60">{{ $t('posts.form.pinterest.title') }}</p>+ <Input+ v-model="pinTitle"+ type="text"+ :placeholder="$t('posts.form.pinterest.title_placeholder')"+ :disabled="disabled || previewOnly"+ :class="titleError ? 'border-rose-500' : undefined"+ />+ <InputError :message="titleError" />+ </div>++ <div class="space-y-2">+ <p class="text-[11px] font-black uppercase tracking-widest text-foreground/60">{{ $t('posts.form.pinterest.link') }}</p>+ <Input+ v-model="pinLink"+ type="text"+ :placeholder="$t('posts.form.pinterest.link_placeholder')"+ :disabled="disabled || previewOnly"+ :class="linkError ? 'border-rose-500' : undefined"+ />+ <InputError :message="linkError" />+ </div>+<pv-if="warning && !previewOnly"class="flex items-start gap-2 rounded-lg border-2 border-foreground bg-rose-50 p-2 text-xs font-semibold text-rose-700"diff --git a/resources/js/components/posts/previews/PinterestPreview.vue b/resources/js/components/posts/previews/PinterestPreview.vueindex badc3fccd..230d7068d 100644--- a/resources/js/components/posts/previews/PinterestPreview.vue+++ b/resources/js/components/posts/previews/PinterestPreview.vue@@ -19,11 +19,15 @@ interface Props {content: string;media: MediaItem[];contentType?: string;+ meta?: Record<string, any>;}const props = defineProps<Props>();const isCarousel = computed(() => props.contentType === 'pinterest_carousel');++const pinTitle = computed(() => (props.meta?.title as string | undefined) || '');+const pinLink = computed(() => (props.meta?.link as string | undefined) || '');</script><template>@@ -116,10 +120,25 @@ const isCarousel = computed(() => props.contentType === 'pinterest_carousel');<!-- Pin Info --><div class="p-2.5">- <!-- Description -->- <div v-if="content" class="text-[13px] text-[#111111] dark:text-[#e0e0e0] line-clamp-2 leading-[17px]">+ <div v-if="pinTitle" class="text-[14px] font-semibold text-[#111111] dark:text-[#e0e0e0] line-clamp-2 leading-[18px]">+ {{ pinTitle }}+ </div>+ <div+ v-if="content"+ class="text-[13px] text-[#111111] dark:text-[#e0e0e0] line-clamp-2 leading-[17px]"+ :class="pinTitle ? 'mt-1' : ''"+ >{{ content }}</div>+ <a+ v-if="pinLink"+ :href="pinLink"+ class="mt-1 block truncate text-[11px] text-[#767676] dark:text-[#a0a0a0]"+ target="_blank"+ rel="noopener noreferrer"+ >+ {{ pinLink }}+ </a><!-- User Info --><div class="flex items-center gap-2 mt-2">diff --git a/tests/Feature/Api/PostApiPlatformMetaTest.php b/tests/Feature/Api/PostApiPlatformMetaTest.phpindex b41aaef49..2bfac126b 100644--- a/tests/Feature/Api/PostApiPlatformMetaTest.php+++ b/tests/Feature/Api/PostApiPlatformMetaTest.php@@ -288,3 +288,104 @@ it('publishes a Discord post when the channel is set', function () {expect($platform->fresh()->meta['channel_id'])->toBe('444555666');Queue::assertPushed(PublishPost::class);});++it('persists Pinterest title and link meta on store', function () {+ $pinterest = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Pinterest]);++ $this->withHeaders($this->headers)+ ->postJson(route('api.posts.store'), [+ 'content' => 'Shared caption',+ 'platforms' => [[+ 'social_account_id' => $pinterest->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'board_id' => 'board-1',+ 'title' => 'Pin Title',+ 'link' => 'https://example.com/product',+ ],+ ]],+ ])+ ->assertCreated();++ $meta = PostPlatform::where('social_account_id', $pinterest->id)->sole()->meta;++ expect(data_get($meta, 'board_id'))->toBe('board-1')+ ->and(data_get($meta, 'title'))->toBe('Pin Title')+ ->and(data_get($meta, 'link'))->toBe('https://example.com/product')+ ->and(array_key_exists('description', $meta))->toBeFalse();+});++it('updates Pinterest title and link meta', function () {+ $pinterest = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Pinterest]);+ $post = Post::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'user_id' => $this->user->id,+ 'content' => 'Shared caption',+ ]);+ $platform = PostPlatform::factory()->pinterest()->create([+ 'post_id' => $post->id,+ 'social_account_id' => $pinterest->id,+ 'enabled' => true,+ 'meta' => ['board_id' => 'board-1'],+ ]);++ $this->withHeaders($this->headers)+ ->putJson(route('api.posts.update', $post), [+ 'status' => PostStatus::Draft->value,+ 'platforms' => [[+ 'id' => $platform->id,+ 'meta' => [+ 'board_id' => 'board-1',+ 'title' => 'Updated Title',+ 'link' => 'https://example.com/updated',+ ],+ ]],+ ])+ ->assertOk();++ $meta = $platform->fresh()->meta;++ expect(data_get($meta, 'title'))->toBe('Updated Title')+ ->and(data_get($meta, 'link'))->toBe('https://example.com/updated')+ ->and(data_get($meta, 'board_id'))->toBe('board-1');+});++it('rejects invalid Pinterest title and link on store', function () {+ $pinterest = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Pinterest]);++ $this->withHeaders($this->headers)+ ->postJson(route('api.posts.store'), [+ 'content' => 'Hello',+ 'platforms' => [[+ 'social_account_id' => $pinterest->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'title' => str_repeat('t', 101),+ 'link' => 'not-a-url',+ ],+ ]],+ ])+ ->assertUnprocessable()+ ->assertJsonValidationErrors([+ 'platforms.0.meta.title' => __('posts.form.pinterest.title_max'),+ 'platforms.0.meta.link' => __('posts.form.pinterest.link_invalid'),+ ]);+});++it('rejects non-http Pinterest links', function () {+ $pinterest = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Pinterest]);++ $this->withHeaders($this->headers)+ ->postJson(route('api.posts.store'), [+ 'content' => 'Hello',+ 'platforms' => [[+ 'social_account_id' => $pinterest->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => ['link' => 'ftp://files.example.com/pin'],+ ]],+ ])+ ->assertUnprocessable()+ ->assertJsonValidationErrors([+ 'platforms.0.meta.link' => __('posts.form.pinterest.link_invalid'),+ ]);+});diff --git a/tests/Feature/Mcp/PostPlatformMetaToolTest.php b/tests/Feature/Mcp/PostPlatformMetaToolTest.phpindex e4681c7fe..910816385 100644--- a/tests/Feature/Mcp/PostPlatformMetaToolTest.php+++ b/tests/Feature/Mcp/PostPlatformMetaToolTest.php@@ -287,3 +287,85 @@ test('publish post succeeds for a Discord platform with a channel', function ()$response->assertOk();Queue::assertPushed(PublishPost::class);});++test('create post persists Pinterest title and link meta', function () {+ $pinterest = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Pinterest]);++ $response = TryPostServer::actingAs($this->user)+ ->tool(CreatePostTool::class, [+ 'content' => 'Shared caption',+ 'platforms' => [[+ 'social_account_id' => $pinterest->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'board_id' => 'board-1',+ 'title' => 'Pin Title',+ 'link' => 'https://example.com/product',+ ],+ ]],+ ]);++ $response->assertOk();++ $meta = PostPlatform::where('social_account_id', $pinterest->id)->sole()->meta;++ expect(data_get($meta, 'title'))->toBe('Pin Title')+ ->and(data_get($meta, 'link'))->toBe('https://example.com/product')+ ->and(array_key_exists('description', $meta))->toBeFalse();+});++test('update post merges Pinterest title and link meta', function () {+ $pinterest = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Pinterest]);+ $post = Post::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'user_id' => $this->user->id,+ 'status' => PostStatus::Draft,+ 'content' => 'Shared caption',+ ]);+ $platform = PostPlatform::factory()->pinterest()->create([+ 'post_id' => $post->id,+ 'social_account_id' => $pinterest->id,+ 'enabled' => true,+ 'meta' => ['board_id' => 'board-1'],+ ]);++ $response = TryPostServer::actingAs($this->user)+ ->tool(UpdatePostTool::class, [+ 'post_id' => $post->id,+ 'platforms' => [[+ 'id' => $platform->id,+ 'meta' => [+ 'board_id' => 'board-1',+ 'title' => 'Updated Title',+ 'link' => 'https://example.com/updated',+ ],+ ]],+ ]);++ $response->assertOk();++ $meta = $platform->fresh()->meta;++ expect(data_get($meta, 'title'))->toBe('Updated Title')+ ->and(data_get($meta, 'link'))->toBe('https://example.com/updated')+ ->and(data_get($meta, 'board_id'))->toBe('board-1');+});++test('create post rejects invalid Pinterest destination link', function () {+ $pinterest = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Pinterest]);++ $response = TryPostServer::actingAs($this->user)+ ->tool(CreatePostTool::class, [+ 'content' => 'Shared caption',+ 'platforms' => [[+ 'social_account_id' => $pinterest->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'board_id' => 'board-1',+ 'link' => 'ftp://files.example.com/pin',+ ],+ ]],+ ]);++ $response->assertHasErrors();+});diff --git a/tests/Feature/Services/Social/PinterestPublisherTest.php b/tests/Feature/Services/Social/PinterestPublisherTest.phpindex fbd9c0a95..3ca4877a0 100644--- a/tests/Feature/Services/Social/PinterestPublisherTest.php+++ b/tests/Feature/Services/Social/PinterestPublisherTest.php@@ -378,6 +378,7 @@ test('pinterest publisher includes title and link when provided', function () {]);$this->post->update([+ 'content' => 'Check out this pin!','media' => [['id' => 'test-media-id',@@ -396,12 +397,150 @@ test('pinterest publisher includes title and link when provided', function () {'*' => Http::response('fake-image-content', 200),]);- $this->publisher->publish($this->postPlatform);+ $this->publisher->publish($this->postPlatform->fresh());Http::assertSent(function ($request) {return str_contains($request->url(), '/v5/pins')&& $request['title'] === 'My Pin Title'- && $request['link'] === 'https://example.com/my-page';+ && $request['link'] === 'https://example.com/my-page'+ && $request['description'] === 'Check out this pin!';+ });+});++test('pinterest publisher uses post content as description and ignores meta description', function () {+ $this->post->update([+ 'content' => 'Shared post caption',+ 'media' => [+ [+ 'id' => 'test-media-id',+ 'path' => 'media/2026-01/image.jpg',+ 'url' => 'https://example.com/media/2026-01/image.jpg',+ 'mime_type' => 'image/jpeg',+ 'original_filename' => 'image.jpg',+ ],+ ],+ ]);++ $this->postPlatform->update([+ 'meta' => [+ 'board_id' => 'board_123',+ 'description' => 'Stale meta description must be ignored',+ ],+ ]);++ Http::fake([+ '*/v5/pins' => Http::response(['id' => 'pin_123456'], 200),+ '*' => Http::response('fake-image-content', 200),+ ]);++ $this->publisher->publish($this->postPlatform->fresh());++ Http::assertSent(function ($request) {+ return str_contains($request->url(), '/v5/pins')+ && $request['description'] === 'Shared post caption';+ });+});++test('pinterest publisher omits description when post content is blank', function () {+ $this->post->update([+ 'content' => '',+ 'media' => [+ [+ 'id' => 'test-media-id',+ 'path' => 'media/2026-01/image.jpg',+ 'url' => 'https://example.com/media/2026-01/image.jpg',+ 'mime_type' => 'image/jpeg',+ 'original_filename' => 'image.jpg',+ ],+ ],+ ]);++ Http::fake([+ '*/v5/pins' => Http::response(['id' => 'pin_123456'], 200),+ '*' => Http::response('fake-image-content', 200),+ ]);++ $this->publisher->publish($this->postPlatform->fresh());++ Http::assertSent(function ($request) {+ return str_contains($request->url(), '/v5/pins')+ && ! array_key_exists('description', $request->data());+ });+});++test('pinterest publisher truncates title to 100 characters', function () {+ $longTitle = str_repeat('T', 150);++ $this->postPlatform->update([+ 'meta' => [+ 'board_id' => 'board_123',+ 'title' => $longTitle,+ ],+ ]);++ $this->post->update([+ 'content' => 'Within limit',+ 'media' => [+ [+ 'id' => 'test-media-id',+ 'path' => 'media/2026-01/image.jpg',+ 'url' => 'https://example.com/media/2026-01/image.jpg',+ 'mime_type' => 'image/jpeg',+ 'original_filename' => 'image.jpg',+ ],+ ],+ ]);++ Http::fake([+ '*/v5/pins' => Http::response(['id' => 'pin_truncated'], 200),+ '*' => Http::response('fake-image-content', 200),+ ]);++ $this->publisher->publish($this->postPlatform->fresh());++ Http::assertSent(function ($request) {+ return str_contains($request->url(), '/v5/pins')+ && mb_strlen($request['title']) === 100+ && $request['description'] === 'Within limit';+ });+});++test('pinterest publisher omits blank title and link', function () {+ $this->postPlatform->update([+ 'meta' => [+ 'board_id' => 'board_123',+ 'title' => '',+ 'link' => '',+ ],+ ]);++ $this->post->update([+ 'content' => 'Caption only',+ 'media' => [+ [+ 'id' => 'test-media-id',+ 'path' => 'media/2026-01/image.jpg',+ 'url' => 'https://example.com/media/2026-01/image.jpg',+ 'mime_type' => 'image/jpeg',+ 'original_filename' => 'image.jpg',+ ],+ ],+ ]);++ Http::fake([+ '*/v5/pins' => Http::response(['id' => 'pin_no_title_link'], 200),+ '*' => Http::response('fake-image-content', 200),+ ]);++ $this->publisher->publish($this->postPlatform->fresh());++ Http::assertSent(function ($request) {+ $data = $request->data();++ return str_contains($request->url(), '/v5/pins')+ && $data['description'] === 'Caption only'+ && ! array_key_exists('title', $data)+ && ! array_key_exists('link', $data);});});@@ -642,6 +781,107 @@ test('pinterest publisher can publish video pin', function () {&& data_get($request->data(), 'media_source.cover_image_key_frame_time') === 0);});+test('pinterest publisher includes title description and link on video pins', function () {+ $this->postPlatform->update([+ 'content_type' => ContentType::PinterestVideoPin,+ 'meta' => [+ 'board_id' => 'board_123',+ 'title' => 'Video Title',+ 'link' => 'https://example.com/video',+ ],+ ]);++ $this->post->update([+ 'content' => 'Video pin caption',+ 'media' => [+ [+ 'id' => 'test-media-video',+ 'path' => 'media/2026-01/video.mp4',+ 'url' => 'https://example.com/media/2026-01/video.mp4',+ 'mime_type' => 'video/mp4',+ 'original_filename' => 'video.mp4',+ ],+ ],+ ]);++ $s3UploadUrl = 'https://pinterest-media-upload.s3.amazonaws.com/upload';++ Http::fake(function ($request) use ($s3UploadUrl) {+ $url = $request->url();++ if (str_contains($url, '/v5/media') && $request->method() === 'POST') {+ return Http::response([+ 'media_id' => 'media_video_789',+ 'upload_url' => $s3UploadUrl,+ 'upload_parameters' => ['key' => 'uploads/video.mp4'],+ ], 201);+ }++ if ($url === $s3UploadUrl) {+ return Http::response('', 204);+ }++ if (str_contains($url, '/v5/media/media_video_789')) {+ return Http::response(['status' => 'succeeded'], 200);+ }++ if (str_contains($url, '/v5/pins')) {+ return Http::response(['id' => 'video_pin_999'], 200);+ }++ return Http::response('fake-video-content', 200);+ });++ $this->publisher->publish($this->postPlatform->fresh());++ Http::assertSent(fn ($request) => $request->url() === config('trypost.platforms.pinterest.api').'/pins'+ && data_get($request->data(), 'title') === 'Video Title'+ && data_get($request->data(), 'description') === 'Video pin caption'+ && data_get($request->data(), 'link') === 'https://example.com/video'+ && data_get($request->data(), 'media_source.source_type') === 'video_id');+});++test('pinterest publisher includes title description and link on carousels', function () {+ $mediaItems = [];+ for ($i = 1; $i <= 2; $i++) {+ $mediaItems[] = [+ 'id' => "test-media-{$i}",+ 'path' => "media/2026-01/image{$i}.jpg",+ 'url' => "https://example.com/media/2026-01/image{$i}.jpg",+ 'mime_type' => 'image/jpeg',+ 'original_filename' => "image{$i}.jpg",+ ];+ }++ $this->postPlatform->update([+ 'content_type' => ContentType::PinterestCarousel,+ 'meta' => [+ 'board_id' => 'board_123',+ 'title' => 'Carousel Title',+ 'link' => 'https://example.com/carousel',+ ],+ ]);++ $this->post->update([+ 'content' => 'Carousel pin caption',+ 'media' => $mediaItems,+ ]);++ Http::fake([+ '*/v5/pins' => Http::response(['id' => 'carousel_pin_123'], 200),+ ]);++ $this->publisher->publish($this->postPlatform->fresh());++ Http::assertSent(function ($request) {+ return str_contains($request->url(), '/v5/pins')+ && $request['title'] === 'Carousel Title'+ && $request['description'] === 'Carousel pin caption'+ && $request['link'] === 'https://example.com/carousel'+ && $request['media_source']['source_type'] === 'multiple_image_urls';+ });+});+test('pinterest video pin uses the provided cover image url over the default frame', function () {$this->postPlatform->update(['content_type' => ContentType::PinterestVideoPin,diff --git a/tests/Feature/UpdatePostRequestTest.php b/tests/Feature/UpdatePostRequestTest.phpindex 0a3ce111e..de6059bda 100644--- a/tests/Feature/UpdatePostRequestTest.php+++ b/tests/Feature/UpdatePostRequestTest.php@@ -585,3 +585,145 @@ test('saving a discord draft without a channel is allowed', function () {])->assertSessionDoesntHaveErrors('platforms.0.meta.channel_id');});++test('saving a pinterest draft persists title and link meta', function () {+ $pinterestAccount = SocialAccount::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'platform' => Platform::Pinterest,+ ]);+ $pinterestPlatform = PostPlatform::factory()->pinterest()->create([+ 'post_id' => $this->post->id,+ 'social_account_id' => $pinterestAccount->id,+ 'meta' => ['board_id' => 'board-1'],+ ]);++ $this->actingAs($this->user)+ ->put(route('app.posts.update', $this->post), [+ 'status' => Status::Draft->value,+ 'content' => 'Shared caption',+ 'platforms' => [[+ 'id' => $pinterestPlatform->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'board_id' => 'board-1',+ 'title' => 'Pin Title',+ 'link' => 'https://example.com/product',+ ],+ ]],+ ])+ ->assertSessionDoesntHaveErrors();++ $meta = $pinterestPlatform->fresh()->meta;++ expect(data_get($meta, 'title'))->toBe('Pin Title')+ ->and(data_get($meta, 'link'))->toBe('https://example.com/product')+ ->and(array_key_exists('description', $meta))->toBeFalse();+});++test('clearing pinterest title and link removes the meta keys', function () {+ $pinterestAccount = SocialAccount::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'platform' => Platform::Pinterest,+ ]);+ $pinterestPlatform = PostPlatform::factory()->pinterest()->create([+ 'post_id' => $this->post->id,+ 'social_account_id' => $pinterestAccount->id,+ 'meta' => [+ 'board_id' => 'board-1',+ 'title' => 'Keep me gone',+ 'link' => 'https://example.com/gone',+ ],+ ]);++ $this->actingAs($this->user)+ ->put(route('app.posts.update', $this->post), [+ 'status' => Status::Draft->value,+ 'platforms' => [[+ 'id' => $pinterestPlatform->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'board_id' => 'board-1',+ 'title' => null,+ 'link' => null,+ ],+ ]],+ ])+ ->assertSessionDoesntHaveErrors();++ $meta = $pinterestPlatform->fresh()->meta;++ expect(data_get($meta, 'board_id'))->toBe('board-1')+ ->and(array_key_exists('title', $meta))->toBeFalse()+ ->and(array_key_exists('link', $meta))->toBeFalse();+});++test('pinterest rejects invalid link when scheduling', function () {+ $pinterestAccount = SocialAccount::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'platform' => Platform::Pinterest,+ ]);+ $pinterestPlatform = PostPlatform::factory()->pinterest()->create([+ 'post_id' => $this->post->id,+ 'social_account_id' => $pinterestAccount->id,+ 'meta' => ['board_id' => 'board-1'],+ ]);++ $mediaPayload = [+ [+ 'id' => 'test-image',+ 'path' => 'media/2026-01/pin.jpg',+ 'url' => 'https://example.com/media/2026-01/pin.jpg',+ 'type' => 'image',+ 'mime_type' => 'image/jpeg',+ 'original_filename' => 'pin.jpg',+ ],+ ];++ $this->actingAs($this->user)+ ->put(route('app.posts.update', $this->post), [+ 'status' => Status::Scheduled->value,+ 'scheduled_at' => now()->addHour()->toIso8601String(),+ 'content' => 'Ready to schedule',+ 'media' => $mediaPayload,+ 'platforms' => [[+ 'id' => $pinterestPlatform->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'board_id' => 'board-1',+ 'link' => 'not-a-url',+ ],+ ]],+ ])+ ->assertSessionHasErrors([+ 'platforms.0.meta.link' => __('posts.form.pinterest.link_invalid'),+ ]);+});++test('pinterest meta title and link validation bounds are enforced', function () {+ $pinterestAccount = SocialAccount::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'platform' => Platform::Pinterest,+ ]);+ $pinterestPlatform = PostPlatform::factory()->pinterest()->create([+ 'post_id' => $this->post->id,+ 'social_account_id' => $pinterestAccount->id,+ 'meta' => [],+ ]);++ $this->actingAs($this->user)+ ->put(route('app.posts.update', $this->post), [+ 'status' => Status::Draft->value,+ 'platforms' => [[+ 'id' => $pinterestPlatform->id,+ 'content_type' => ContentType::PinterestPin->value,+ 'meta' => [+ 'title' => str_repeat('t', 101),+ 'link' => 'not-a-url',+ ],+ ]],+ ])+ ->assertSessionHasErrors([+ 'platforms.0.meta.title' => __('posts.form.pinterest.title_max'),+ 'platforms.0.meta.link' => __('posts.form.pinterest.link_invalid'),+ ]);+});diff --git a/tests/Unit/PostPlatformMetaRulesTest.php b/tests/Unit/PostPlatformMetaRulesTest.phpnew file mode 100644index 000000000..f3af6ec52--- /dev/null+++ b/tests/Unit/PostPlatformMetaRulesTest.php@@ -0,0 +1,33 @@+<?php++declare(strict_types=1);++use App\Support\PostPlatformMetaRules;++test('custom meta messages only cover pinterest title and link', function () {+ expect(PostPlatformMetaRules::messages())->toBe([+ 'platforms.*.meta.link.url' => __('posts.form.pinterest.link_invalid'),+ 'platforms.*.meta.link.max' => __('posts.form.pinterest.link_max'),+ 'platforms.*.meta.title.max' => __('posts.form.pinterest.title_max'),+ ]);+});++test('custom meta attributes only rename pinterest title and link', function () {+ expect(PostPlatformMetaRules::attributes())->toBe([+ 'platforms.*.meta.title' => __('posts.form.pinterest.title'),+ 'platforms.*.meta.link' => __('posts.form.pinterest.link'),+ ]);+});++test('shared meta rules still include non-pinterest platform fields', function () {+ $rules = PostPlatformMetaRules::rules();++ expect($rules)->toHaveKeys([+ 'platforms.*.meta.aspect_ratio',+ 'platforms.*.meta.privacy_level',+ 'platforms.*.meta.board_id',+ 'platforms.*.meta.channel_id',+ 'platforms.*.meta.title',+ 'platforms.*.meta.link',+ ]);+});