Design changes

This commit is contained in:
Khushboo Verma 2024-01-15 17:07:12 +05:30
parent 882e049ac9
commit 5904b17b5c
3 changed files with 51 additions and 31 deletions

View file

@ -1,21 +1,38 @@
Hi <strong><?php echo $this->getParam('user') ?></strong>,
<br /><br />
Your webhook <strong><?php echo $this->getParam('webhook') ?></strong> on project <strong><?php echo $this->getParam('project') ?></strong> has been paused after <?php echo $this->getParam('attempts') ?> consecutive failures. <br /><br />
<p>Webhook URL: <strong><?php echo $this->getParam('url') ?></strong></p>
<p>Error: <strong><?php echo $this->getParam('error') ?></strong></p> <br />To restore the functionality of your webhook, please take the following steps:<br /><br />
1. Debug the webhook to identify and resolve the issue:
<ul>
<li>Examine the logs of both Appwrite Console and your webhook server to identify the issue</li>
<li>Investigate potential network issues and use webhook testing tools to verify expected behaviour</li>
<li>Ensure the webhook URL is reachable and configured to accept incoming POST requests</li>
<li>Confirm that the webhook doesn't return error status codes such as 400 or 500</li>
</ul>
2. Re-enable the webhook from the project settings page
<html>
<table border="0" cellspacing="0" cellpadding="0" style="padding-top: 10px; padding-bottom: 10px; display: inline-block; margin-top: 32px">
<tr>
<td align="center" style="border-radius: 8px; background-color: #FD366E;">
<a rel="noopener" target="_blank" href="<?php echo $this->getParam('redirect') ?>" style="font-size: 14px; font-family: Inter; color: #ffffff; text-decoration: none; border-radius: 8px; padding: 9px 14px; border: 1px solid #FD366E; display: inline-block;">View webhook settings</a>
</td>
</tr>
</table>
<head>
<style>
@media (max-width:500px) {
.mobile-full-width {
width: 100%;
}
}
</style>
</head>
<body>
Hi <strong><?php echo $this->getParam('user') ?></strong>,
<br /><br />
Your webhook <strong><?php echo $this->getParam('webhook') ?></strong> on project <strong><?php echo $this->getParam('project') ?></strong> has been paused after <?php echo $this->getParam('attempts') ?> consecutive failures. <br />
<p>Webhook Endpoint: <strong><?php echo $this->getParam('url') ?></strong></p>
<p>Error: <strong><?php echo $this->getParam('error') ?></strong></p> <br />To restore your webhook's functionality and reset attempts, we suggest to follow the below steps:<br />
<ol>
<li>Examine the logs of both Appwrite Console and your webhook server to identify the issue.</li>
<li>Investigate potential network issues and use webhook testing tools to verify expected behaviour.</li>
<li>Ensure the webhook endpoint is reachable and configured to accept incoming POST requests.</li>
<li>Confirm that the webhook doesn't return error status codes such as 400 or 500.</li>
</ol><br />
After the issue is resolved, please make sure to re-enable the webhook directly through the webhook settings.
<table border="0" cellspacing="0" cellpadding="0" style="padding-top: 10px; padding-bottom: 10px; margin-top: 32px">
<tr>
<td style="border-radius: 8px; display: block; width: 100%;">
<a class="mobile-full-width" rel="noopener" target="_blank" href="<?php echo $this->getParam('redirect') ?>" style="font-size: 14px; font-family: Inter; color: #ffffff; text-decoration: none; background-color: #FD366E; border-radius: 8px; padding: 9px 14px; border: 1px solid #FD366E; display: inline-block; text-align:center; box-sizing: border-box;">Webhook settings</a>
</td>
</tr>
</table>
</body>
</html>

16
composer.lock generated
View file

@ -5380,16 +5380,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.8.0",
"version": "3.8.1",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7"
"reference": "14f5fff1e64118595db5408e946f3a22c75807f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7",
"reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7",
"reference": "14f5fff1e64118595db5408e946f3a22c75807f7",
"shasum": ""
},
"require": {
@ -5399,11 +5399,11 @@
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
"bin/phpcbf",
"bin/phpcs"
],
"type": "library",
"extra": {
@ -5456,7 +5456,7 @@
"type": "open_collective"
}
],
"time": "2023-12-08T12:32:31+00:00"
"time": "2024-01-11T20:47:48+00:00"
},
{
"name": "swoole/ide-helper",

View file

@ -158,6 +158,8 @@ class Webhooks extends Action
$webhook->setAttribute('logs', $logs);
if ($attempts >= self::MAX_FAILED_ATTEMPTS) {
$webhook->setAttribute('enabled', false);
$protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
$hostname = App::getEnv('_APP_DOMAIN');
$projectId = $project->getId();
@ -174,12 +176,13 @@ class Webhooks extends Action
$template->setParam('redirect', $protocol . '://' . $hostname . "/console/project-$projectId/settings/webhooks/$webhookId");
$template->setParam('attempts', $attempts);
$subject = 'Your webhook has been paused';
$body = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-base.tpl');
$subject = 'Webhook deliveries have been paused';
$body = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-base-cloud.tpl');
$body
->setParam('{{subject}}', $subject)
->setParam('{{body}}', $template->render());
->setParam('{{message}}', $template->render())
->setParam('{{year}}', date("Y"));
$queueForMails
->setSubject($subject)