Point the public site to each project's TaskStream board
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / test-postgres (push) Has been cancelled
Tests / mcp (push) Has been cancelled

A project with a board now carries its key, its address and the address
of the board's public showcase in the public API, so the website can show
its roadmap, releases and tickets for newcomers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 19:13:56 +02:00
parent b32d6bf001
commit 7e7d2847fe
6 changed files with 83 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ namespace App\Http\Resources\PublicApi;
use App\Models\Media;
use App\Models\Project;
use App\Services\TaskStream\TaskStreamClient;
use App\Support\ImagePayload;
use App\Support\SiteUrls;
use App\Support\TranslatablePayload;
@@ -110,11 +111,30 @@ class PublicProjectResource extends JsonResource
// alive without anyone maintaining it.
'repositories' => PublicRepositoryResource::collection($this->whenLoaded('repositories')),
// Its board in TaskStream, when it has one: the public site reads
// the roadmap, releases and tickets for newcomers from there.
'taskstream' => $this->taskstream_key === null ? null : $this->taskstream(),
'alternates' => SiteUrls::alternates($this->resource, 'project'),
'path' => SiteUrls::alternates($this->resource, 'project')[$locale] ?? null,
];
}
/**
* @return array{key: string, url: string, web_url: string, showcase_url: string}
*/
protected function taskstream(): array
{
$client = app(TaskStreamClient::class);
return [
'key' => $this->taskstream_key,
'url' => $client->projectUrl($this->taskstream_key),
'web_url' => $client->webUrl(),
'showcase_url' => $client->showcaseUrl($this->taskstream_key),
];
}
/**
* The media row when the caller loaded it, and null otherwise — never a
* lazy load, because this runs once per row in a listing.