This commit is contained in:
Dennis Eichhorn 2024-02-04 20:34:12 +00:00
parent f48b4e9f1c
commit 1aaa596628
3 changed files with 17 additions and 41 deletions

View File

@ -9,12 +9,12 @@
"l11n": {
"en": {
"subject": "ORW Resource Change",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Resource Change</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Resource Change</h1><p style=\"margin-bottom: 20px;\">The resource {resource.url} changed.</p><p style=\"margin-top: 40px;\">This email is sent to you from {owner_email}, if you don't wan't to receive these emails click <a href=\"https://orw.jingga.app/unsubscribe?email={email}&resource={resource.id}\">here</a></p><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058</p></td></tr></table></td></tr></table></body></html>",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Resource Change</title></head><body style=\"font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Resource Change</h1><p style=\"margin-bottom: 20px;\">The resource {resource.url} changed.</p><p style=\"margin-top: 40px;\">This email is sent to you from {owner_email}, if you don't wan't to receive these emails click <a href=\"https://orw.jingga.app/unsubscribe?email={email}&resource={resource.id}\">here</a></p><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Resource Change\n\nThe resource {resource.url} changed.\n\n\nThis email is sent to you from {owner_email}, if you don't wan't to receive these emails visit https://orw.jingga.app/unsubscribe?email={email}&resource={resource.id}\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058"
},
"de": {
"subject": "Ressourcenänderung",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Ressourcenänderung</title></head><body style=\"font-family: Arial, sans-serif; font-size: 16px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Ressourcenänderung</h1><p style=\"margin-bottom: 20px;\">Die Ressource {resource.url} hat sich geändert.</p><p style=\"margin-top: 40px;\">Diese E-Mail wird Ihnen von {owner_email} gesendet. Wenn Sie diese E-Mails nicht mehr erhalten möchten, klicken Sie <a href=\"https://orw.jingga.app/unsubscribe?email={email}&resource={resource.id}\">hier</a>.</p><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058</p></td></tr></table></td></tr></table></body></html>",
"body": "<!DOCTYPE html><html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Ressourcenänderung</title></head><body style=\"font-family: Arial, sans-serif; font-size: 14px; line-height: 1.5;\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><tr><td><table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"600\" style=\"margin: 0 auto; background-color: #ffffff;\"><tr><td style=\"padding: 40px 0; text-align: center;\"><h1 style=\"margin-top: 0; color: #000000; font-size: 24px;\">Ressourcenänderung</h1><p style=\"margin-bottom: 20px;\">Die Ressource {resource.url} hat sich geändert.</p><p style=\"margin-top: 40px;\">Diese E-Mail wird Ihnen von {owner_email} gesendet. Wenn Sie diese E-Mails nicht mehr erhalten möchten, klicken Sie <a href=\"https://orw.jingga.app/unsubscribe?email={email}&resource={resource.id}\">hier</a>.</p><p style=\"margin-top: 40px;\">Jingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058</p></td></tr></table></td></tr></table></body></html>",
"bodyalt": "Ressourcenänderung\n\nDie Ressource {resource.url} hat sich geändert.\n\nDiese E-Mail wird Ihnen von {owner_email} gesendet. Wenn Sie diese E-Mails nicht mehr erhalten möchten, besuchen Sie https://orw.jingga.app/unsubscribe?email={email}&resource={resource.id}\n\n\nJingga e.K. - www.jingga.app - CEO Dennis Eichhorn - Amtsgericht Friedberg HRA 5058"
}
},

View File

@ -295,9 +295,13 @@ final class ApiController extends Controller
/** @var \Model\Setting $emailSettings */
$emailSettings = $this->app->appSettings->get(
names: SettingsEnum::MAIL_SERVER_ADDR,
module: 'OnlineResourceWatcher'
module: 'Admin'
);
if (empty($emailSettings->content)) {
return;
}
/** @var \Model\Setting $templateSettings */
$templateSettings = $this->app->appSettings->get(
names: OrwSettingsEnum::ORW_CHANGE_MAIL_TEMPLATE,
@ -343,40 +347,18 @@ final class ApiController extends Controller
}
$mail->subject = $mailL11n->subject;
$mail->body = $mailL11n->body;
$mail->bodyAlt = $mailL11n->bodyAlt;
$mail->template = [
'{resource.id}' => $resource->id,
'{email}' => $inform->email,
'{resource.url}' => $resource->uri,
'{owner_email}' => $resource->owner->getEmail(),
];
$mail->body = \str_replace(
[
'{resource.id}',
'{email}',
'{resource.url}',
'{owner_email}',
],
[
$resource->id,
$inform->email,
$resource->uri,
$resource->owner->getEmail(),
],
$mailL11n->body
);
$mail->msgHTML($mail->body);
$mail->bodyAlt = \str_replace(
[
'{resource.id}',
'{email}',
'{resource.url}',
'{owner_email}',
],
[
$resource->id,
$inform->email,
$resource->uri,
$resource->owner->getEmail(),
],
$mailL11n->bodyAlt
);
$mail->addTo($inform->email);
$handler->send($mail);
}
@ -652,8 +634,6 @@ final class ApiController extends Controller
' '
)
);
// @todo allow $resource->path handling for html paths
} elseif (\in_array($extension, self::IMG_RENDERABLE)) {
$diffPath = \dirname($newPath) . '/_' . \basename($newPath);

View File

@ -26,12 +26,8 @@ use phpOMS\Uri\UriFactory;
continue;
}
$old = $new;
$old = $new ?? $report;
$new = $report;
if ($old === null) {
$old = $report;
}
}
if ($resource->checkedAt !== null) :