Skip to content

Modern Docker Management, Designed for Everyone

fix: default notifySelf to true and add setting for Signal notifications (#4302)

Raymond Ha157730f10264
diff --git a/backend/pkg/utils/notifications/config.go b/backend/pkg/utils/notifications/config.go
index 21bf28220..9a98dba57 100644
--- a/backend/pkg/utils/notifications/config.go
+++ b/backend/pkg/utils/notifications/config.go
@@ -104,6 +104,7 @@ type SignalConfig struct {
Source string `json:"source"`
Recipients []string `json:"recipients"`
DisableTLS bool `json:"disableTls"`
+ NotifySelf *bool `json:"notifySelf,omitempty"`
Events map[NotificationEventType]bool `json:"events,omitempty"`
}
diff --git a/backend/pkg/utils/notifications/signal_sender.go b/backend/pkg/utils/notifications/signal_sender.go
index 1d4ce2bea..7f069aaa4 100644
--- a/backend/pkg/utils/notifications/signal_sender.go
+++ b/backend/pkg/utils/notifications/signal_sender.go
@@ -10,6 +10,11 @@ import (
// BuildSignalURL converts SignalConfig to Shoutrrr URL format using shoutrrr's Config
func BuildSignalURL(config SignalConfig) (string, error) {
+ notifySelf := true
+ if config.NotifySelf != nil {
+ notifySelf = *config.NotifySelf
+ }
+
signalConfig := &signal.Config{
Host: config.Host,
Port: config.Port,
@@ -19,6 +24,7 @@ func BuildSignalURL(config SignalConfig) (string, error) {
Source: config.Source,
Recipients: config.Recipients,
DisableTLS: config.DisableTLS,
+ NotifySelf: notifySelf,
}
url := signalConfig.GetURL()
diff --git a/backend/pkg/utils/notifications/signal_sender_test.go b/backend/pkg/utils/notifications/signal_sender_test.go
index 489afe776..06cb05bbe 100644
--- a/backend/pkg/utils/notifications/signal_sender_test.go
+++ b/backend/pkg/utils/notifications/signal_sender_test.go
@@ -87,6 +87,47 @@ func TestBuildSignalURL(t *testing.T) {
assert.Contains(t, url, "port=9443")
},
},
+ {
+ name: "NotifySelf defaults to true (omitted in shoutrrr URL)",
+ config: SignalConfig{
+ Host: "signal.example.com",
+ Port: 8080,
+ Token: "token123",
+ Source: "+1234567890",
+ Recipients: []string{"+0987654321"},
+ },
+ check: func(url string) bool {
+ return assert.NotContains(t, url, "notifyself=")
+ },
+ },
+ {
+ name: "NotifySelf explicitly true (omitted in shoutrrr URL)",
+ config: SignalConfig{
+ Host: "signal.example.com",
+ Port: 8080,
+ Token: "token123",
+ Source: "+1234567890",
+ Recipients: []string{"+0987654321"},
+ NotifySelf: new(true),
+ },
+ check: func(url string) bool {
+ return assert.NotContains(t, url, "notifyself=")
+ },
+ },
+ {
+ name: "NotifySelf explicitly false (included as notifyself=No)",
+ config: SignalConfig{
+ Host: "signal.example.com",
+ Port: 8080,
+ Token: "token123",
+ Source: "+1234567890",
+ Recipients: []string{"+0987654321"},
+ NotifySelf: new(false),
+ },
+ check: func(url string) bool {
+ return assert.Contains(t, url, "notifyself=No")
+ },
+ },
}
for _, tt := range tests {
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 8f98bb6f6..f646e0109 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -2665,6 +2665,8 @@
"notifications_signal_recipients_help": "Comma-separated list of phone numbers (with +) or Signal group IDs",
"notifications_signal_recipients_required": "At least one recipient is required when Signal is enabled",
"notifications_signal_disable_tls_description": "Disable TLS/SSL for Signal REST API connection (not recommended for production)",
+ "notifications_signal_notify_self_label": "Notify Self",
+ "notifications_signal_notify_self_description": "Alert the sender's own devices when sending notifications to groups or self",
"notifications_slack_title": "Slack",
"notifications_slack_description": "Send notifications to Slack channels or direct messages",
"notifications_slack_token_label": "Slack Token",
diff --git a/frontend/src/lib/types/notifications.ts b/frontend/src/lib/types/notifications.ts
index d6bf51650..0af7a1190 100644
--- a/frontend/src/lib/types/notifications.ts
+++ b/frontend/src/lib/types/notifications.ts
@@ -99,6 +99,7 @@ export interface SignalFormValues extends BaseProviderFormValues {
source: string;
recipients: string;
disableTls: boolean;
+ notifySelf: boolean;
}
export interface SlackFormValues extends BaseProviderFormValues {
@@ -326,6 +327,7 @@ export function signalSettingsToFormValues(settings?: NotificationSettings): Sig
source: getString(cfg, 'source'),
recipients: getStringArray(cfg, 'recipients').join(', '),
disableTls: getBoolean(cfg, 'disableTls', false),
+ notifySelf: getBoolean(cfg, 'notifySelf', true),
...eventFlagsToFormValues(events)
};
}
@@ -412,6 +414,7 @@ export function signalFormValuesToSettings(values: SignalFormValues): Notificati
.map((recipient) => recipient.trim())
.filter((recipient) => recipient.length > 0),
disableTls: values.disableTls,
+ notifySelf: values.notifySelf,
events: formValuesToEventFlags(values)
}
};
diff --git a/frontend/src/routes/(app)/settings/notifications/components/providers/built-in-provider-form.svelte b/frontend/src/routes/(app)/settings/notifications/components/providers/built-in-provider-form.svelte
index 9bb84631d..6de6897b7 100644
--- a/frontend/src/routes/(app)/settings/notifications/components/providers/built-in-provider-form.svelte
+++ b/frontend/src/routes/(app)/settings/notifications/components/providers/built-in-provider-form.svelte
@@ -201,6 +201,7 @@
source: z.string(),
recipients: z.string(),
disableTls: z.boolean(),
+ notifySelf: z.boolean(),
...eventSubscriptionSchemaFields
})
.superRefine((d, ctx) => {
@@ -610,6 +611,13 @@
helpText: m.notifications_signal_recipients_help(),
rows: 3
},
+ {
+ kind: 'switch',
+ key: 'notifySelf',
+ id: 'signal-notify-self',
+ label: m.notifications_signal_notify_self_label(),
+ description: m.notifications_signal_notify_self_description()
+ },
{
kind: 'switch',
key: 'disableTls',