Skip to content

fix(pinterest): restore board picker + require board_id in validation#39

Merged
paulocastellano merged 2 commits into
mainfrom
fix/pinterest-board-picker
May 15, 2026
Merged

fix(pinterest): restore board picker + require board_id in validation#39
paulocastellano merged 2 commits into
mainfrom
fix/pinterest-board-picker

Conversation

@paulocastellano
Copy link
Copy Markdown
Contributor

The bug

Production: scheduled Pinterest posts failing with "Pinterest board_id is required". The post editor lost the board picker during a UI rewrite (commit `35646bb`), so users couldn't select a board, and there was no backend validation catching it.

What this does

Backend

  • `PostController::edit` — `pinterestBoards` is now `Record<account_id, Board[]>` (mirrors the TikTok `creatorInfos` pattern). Supports multi-account workspaces.
  • `UpdatePostRequest` — adds `platforms.*.meta.board_id` rule + after-validator that rejects `Publishing`/`Scheduling` Pinterest posts without `board_id`. Drafts skip the rule.

Frontend

  • `PinterestSettings.vue` — Combobox board picker (searchable, with empty-state warning when no boards). Emits `update:meta` with `board_id`.
  • `ScheduleTab` / `PostEditorSidebar` / `Edit` — plumb `pinterestBoards` down by `social_account_id`.

Tests (6 new, 1542 total)

Regression-prevention is the explicit goal — if anyone removes the picker again or weakens the validation, the build breaks:

  • `UpdatePostRequestTest`:
    • publishing without `board_id` rejected
    • publishing with `board_id` passes
    • scheduling without `board_id` rejected
    • publishing carousel without `board_id` rejected
    • publishing video pin without `board_id` rejected
    • draft without `board_id` allowed
    • multi-platform (Pinterest + LinkedIn): Pinterest errors, LinkedIn passes
  • `PinterestPublisherTest`:
    • publish carousel without `board_id` throws (existing image-pin case kept)
    • publish video pin without `board_id` throws

Test plan

  • Full suite: 1542 passing
  • Manual: connect Pinterest account → create post → editor shows board picker → select board → publish succeeds
  • Manual: empty Pinterest account (no boards) → warning visible instead of empty Combobox
  • Manual: token expired on one account, valid on another → only valid one shows boards (failures isolated by `rescue()`)

Follow-ups (not in this PR)

  • Cache the boards fetch (currently 1 Pinterest API call per account per editor load)
  • Clear `meta.board_id` if the referenced board was deleted in Pinterest
  • Distinguish "token expired" from "no boards" in the empty-state copy

The post editor lost the Pinterest board picker during a UI rewrite,
causing scheduled posts to fail in production with 'Pinterest board_id
is required'. This restores the picker and locks the contract with
validation + tests so the regression cannot happen silently again.

Backend:
- PostController: pinterestBoards is now Record<account_id, Board[]>
  (mirrors the TikTok creator-info pattern); supports multi-account.
- UpdatePostRequest: 'platforms.*.meta.board_id' rule + after-validator
  rejects Publishing/Scheduling Pinterest posts without board_id.

Frontend:
- PinterestSettings.vue: Combobox board picker with empty-state warning;
  emits update:meta with board_id.
- ScheduleTab / PostEditorSidebar / Edit pass pinterestBoards down by
  social_account_id.

Tests (6 new):
- UpdatePostRequestTest: rejects publishing/scheduling without board_id
  across pin/carousel/video pin; allows draft without board_id;
  pinterest error doesn't block sibling platforms in multi-platform.
- PinterestPublisherTest: publisher throws for carousel + video pin
  when no board_id (existing image-pin case kept).

1542 tests passing.
- PinterestSettings: replace inline error markup with the shared
  InputError component (matches the rest of the form patterns)
- Extract PinterestBoard type to @/types and use it across
  PinterestSettings, ScheduleTab, PostEditorSidebar, Edit — drops
  the duplicated inline {id, name} shape from 4 call sites
- Block publish/schedule when Pinterest is selected but no board is
  picked (mirrors tiktokComplianceValid). Tooltip surfaces the same
  i18n key the backend uses, so frontend + backend speak the same
  language
@paulocastellano paulocastellano merged commit 4cd0b64 into main May 15, 2026
2 checks passed
@paulocastellano paulocastellano deleted the fix/pinterest-board-picker branch May 15, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant