fix(vcs): use the mapped status when picking the comment image extension

Sites map the `processing` status onto the `building` image, but the
extension was still derived from the raw status, so a processing
deployment asked for `status-building-light.png`, which does not exist.
Only the `.gif` variants are shipped for `building`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matej BačoandClaude Opus 5 committed 2026-09-19 11:48:44 +02:00
1 parent f61009be8c
commit 980c4f94a8
2 files changed
+34 -1

No files matched your search

+1 -1
View File
@@ -147,7 +147,7 @@ class Comment
foreach ($project['site'] as $siteId => $site) {
$imageStatus = in_array($site['status'], ['processing', 'building']) ? 'building' : $site['status'];
$extension = $site['status'] === 'building' ? 'gif' : 'png';
$extension = $imageStatus === 'building' ? 'gif' : 'png';
$pathLight = '/images/vcs/status-' . $imageStatus . '-light.' . $extension;
$pathDark = '/images/vcs/status-' . $imageStatus . '-dark.' . $extension;
+33
View File
@@ -135,6 +135,39 @@ final class CommentTest extends TestCase
$this->assertSame($firstTip, $secondTip);
}
public function testSiteStatusImagesMatchExistingFiles(): void
{
$extensions = [
'waiting' => 'status-waiting-%s.png',
'processing' => 'status-building-%s.gif',
'building' => 'status-building-%s.gif',
'ready' => 'status-ready-%s.png',
'failed' => 'status-failed-%s.png',
];
foreach ($extensions as $status => $file) {
$comment = new Comment(['consoleHostname' => 'localhost']);
$comment->addBuild(
new Document(['$id' => 'project1', 'name' => 'Test Project', 'region' => 'default']),
new Document(['$id' => 'site1', 'name' => 'Test Site']),
'site',
$status,
'dep1',
['type' => 'logs'],
'https://example.appwrite.network'
);
$generated = $comment->generateComment();
foreach (['light', 'dark'] as $scheme) {
$path = \sprintf($file, $scheme);
$this->assertStringContainsString('/images/vcs/' . $path, $generated);
$this->assertFileExists(__DIR__ . '/../../../public/images/vcs/' . $path);
}
}
}
private function extractTip(string $comment): ?string
{
if (\preg_match('/> \[!TIP\]\n> (.+)/', $comment, $matches)) {