diff --git a/src/Appwrite/Vcs/Comment.php b/src/Appwrite/Vcs/Comment.php index 1107e0ee70..55e11ec790 100644 --- a/src/Appwrite/Vcs/Comment.php +++ b/src/Appwrite/Vcs/Comment.php @@ -2,8 +2,8 @@ namespace Appwrite\Vcs; -use Utopia\Database\Document; use Utopia\App; +use Utopia\Database\Document; class Comment { @@ -65,18 +65,23 @@ class Comment ]; } - //TODO: Update link to documentation - $text .= "**Your function has been automatically deployed.** Learn more about Appwrite [Function Deployments](https://appwrite.io/docs/functions).\n\n"; - foreach ($projects as $projectId => $project) { - $text .= "**{$project['name']}** `{$projectId}`\n\n"; - $text .= "| Function | ID | Status | Action |\n"; - $text .= "| :- | :- | :- | :- |\n"; - - $protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = App::getEnv('_APP_DOMAIN'); - foreach ($project['functions'] as $functionId => $function) { + if ($function['status'] === 'waiting' || $function['status'] === 'processing' || $function['status'] === 'building') { + $text .= "**Your function deployment is in progress. Please check back in a few minutes for the updated status.**\n\n"; + } elseif ($function['status'] === 'ready') { + $text .= "**Your function has been successfully deployed.**\n\n"; + } else { + $text .= "**Your function deployment has failed. Please check the logs for more details and retry.**\n\n"; + } + + $text .= "Project name: **{$project['name']}** \nProject ID: `{$projectId}`\n\n"; + $text .= "| Function | ID | Status | Action |\n"; + $text .= "| :- | :- | :- | :- |\n"; + + $protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = App::getEnv('_APP_DOMAIN'); + $generateImage = function (string $status) use ($protocol, $hostname) { $extention = $status === 'building' ? 'gif' : 'png'; $imagesUrl = $protocol . '://' . $hostname . '/images/vcs/'; @@ -104,7 +109,9 @@ class Comment $text .= "\n\n"; } - //TODO: Update did you know section + $functionUrl = $protocol . '://' . $hostname . '/console/project-' . $projectId . '/functions/function-' . $functionId; + $text .= "Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to [your deployments]($functionUrl). Learn more about Appwrite [Function deployments](https://appwrite.io/docs/functions).\n\n"; + $tip = $this->tips[array_rand($this->tips)]; $text .= "> **💡 Did you know?** \n " . $tip . "\n\n";