Skip to content

Commit 377bf65

Browse files
authored
fix(ntfy): remove undefined fields from ntfy payload (#2931)
1 parent 2d4cd03 commit 377bf65

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • server/lib/notifications/agents

server/lib/notifications/agents/ntfy.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,21 @@ class NtfyAgent
9595
click = `${applicationUrl}/${payload.media.mediaType}/${payload.media.tmdbId}`;
9696
}
9797

98-
return {
98+
const ntfyPayload: Record<string, unknown> = {
9999
topic,
100100
priority,
101101
title,
102102
message,
103103
markdown: true,
104-
attach,
105-
click,
106104
};
105+
if (attach) {
106+
ntfyPayload.attach = attach;
107+
}
108+
if (click) {
109+
ntfyPayload.click = click;
110+
}
111+
112+
return ntfyPayload;
107113
}
108114

109115
public shouldSend(): boolean {

0 commit comments

Comments
 (0)