Unwrap Pinterest board lists for the web editors.

getBoards now returns {boards, truncated}; pass only the boards array into Inertia pinterestBoards so post and automation pickers keep receiving an array.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Paulo Castellano 2026-07-24 22:54:20 -03:00
parent e4779dfcdf
commit d8e43bcfbb
3 changed files with 14 additions and 3 deletions

View file

@ -34,7 +34,11 @@ public function __invoke(Automation $automation): array
->where('platform', Platform::Pinterest)
->mapWithKeys(fn ($account) => [
$account->id => rescue(
fn () => $this->pinterestPublisher->getBoards($account),
fn () => data_get(
$this->pinterestPublisher->getBoards($account),
'boards',
[],
),
[],
report: false,
),

View file

@ -260,7 +260,11 @@ public function edit(Request $request, Post $post): Response|RedirectResponse
->where('platform', Platform::Pinterest)
->mapWithKeys(fn ($account) => [
$account->id => rescue(
fn () => app(PinterestPublisher::class)->getBoards($account),
fn () => data_get(
app(PinterestPublisher::class)->getBoards($account),
'boards',
[],
),
[],
report: false,
),

View file

@ -135,7 +135,10 @@
});
it('maps pinterest boards for pinterest accounts', function () {
$this->mock(PinterestPublisher::class, fn ($mock) => $mock->shouldReceive('getBoards')->andReturn([['id' => 'b1']]));
$this->mock(PinterestPublisher::class, fn ($mock) => $mock->shouldReceive('getBoards')->andReturn([
'boards' => [['id' => 'b1']],
'truncated' => false,
]));
$this->mock(TikTokCreatorInfo::class);
$workspace = Workspace::factory()->create();