feat: improve Apprise notification subject/title handling and fallbacks

- lib/Controller/WebhookController.php: Extract subject/title from wrapper level and add fallback to default sender name
- lib/Service/TalkService.php: Update display name logic to check subject, and use title/subject as message body when empty
This commit is contained in:
kyle
2026-06-12 17:53:30 -07:00
parent 28d0187760
commit 98e044ede7
2 changed files with 27 additions and 2 deletions
+14 -2
View File
@@ -587,8 +587,10 @@ class TalkService {
public function mapApprisePayload(array $data, string $roomToken = ''): array {
$parts = [];
// Display name: use Apprise title (source/app name) as the display name
$displayName = !empty($data['title']) ? $data['title'] : $this->config->getAppValue(self::APP_ID, 'sender_name', 'Webhook Bot');
// Display name: use Apprise title/subject (source/app name) as the display name
$displayName = !empty($data['title']) ? $data['title']
: (!empty($data['subject']) ? $data['subject']
: $this->config->getAppValue(self::APP_ID, 'sender_name', 'Webhook Bot'));
// Body
if (!empty($data['body'])) {
@@ -658,6 +660,16 @@ class TalkService {
$message = implode("\n\n", $parts);
// If body is empty but we have a title/subject, use it as the message
// (handles test notifications and simple alerts with no body)
if ($message === '') {
if (!empty($data['title'])) {
$message = $data['title'];
} elseif (!empty($data['subject'])) {
$message = $data['subject'];
}
}
// Sender name: use app name if available, otherwise default
$senderName = $displayName;