From 35f8337a3634993700272b9ca413d59ea97977de Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Tue, 30 Jul 2024 16:53:40 +0100 Subject: [PATCH] jellyseer: revert auto-nulling of NotifTypes All-zeros in NotifTypes means the user shouldn't receive any communication, which is a state we'd like to store in/apply from a profile. --- jellyseerr/jellyseerr.go | 5 +++-- jellyseerr/models.go | 36 ++++++++++++++++++------------------ main.go | 1 + 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/jellyseerr/jellyseerr.go b/jellyseerr/jellyseerr.go index 1a231fa..cddb86b 100644 --- a/jellyseerr/jellyseerr.go +++ b/jellyseerr/jellyseerr.go @@ -356,9 +356,10 @@ func (js *Jellyseerr) GetNotificationPreferencesByID(jellyseerrID int64) (Notifi } func (js *Jellyseerr) ApplyNotificationsTemplateToUser(jfID string, tmpl NotificationsTemplate) error { - if tmpl.NotifTypes.Empty() { + // This behaviour is not desired, this being all-zero means no notifications, which is a settings state we'd want to store! + /* if tmpl.NotifTypes.Empty() { tmpl.NotifTypes = nil - } + }*/ u, err := js.MustGetUser(jfID) if err != nil { return err diff --git a/jellyseerr/models.go b/jellyseerr/models.go index 76e1783..5de1c5b 100644 --- a/jellyseerr/models.go +++ b/jellyseerr/models.go @@ -71,19 +71,19 @@ type permissionsDTO struct { type Permissions int type NotificationTypes struct { - Discord int64 `json:"discord,omitempty"` - Email int64 `json:"email,omitempty"` - Pushbullet int64 `json:"pushbullet,omitempty"` - Pushover int64 `json:"pushover,omitempty"` - Slack int64 `json:"slack,omitempty"` - Telegram int64 `json:"telegram,omitempty"` - Webhook int64 `json:"webhook,omitempty"` - Webpush int64 `json:"webpush,omitempty"` + Discord int64 `json:"discord"` + Email int64 `json:"email"` + Pushbullet int64 `json:"pushbullet"` + Pushover int64 `json:"pushover"` + Slack int64 `json:"slack"` + Telegram int64 `json:"telegram"` + Webhook int64 `json:"webhook"` + Webpush int64 `json:"webpush"` } -func (nt *NotificationTypes) Empty() bool { +/* func (nt *NotificationTypes) Empty() bool { return nt.Discord == 0 && nt.Email == 0 && nt.Pushbullet == 0 && nt.Pushover == 0 && nt.Slack == 0 && nt.Telegram == 0 && nt.Webhook == 0 && nt.Webpush == 0 -} +} */ type NotificationsField string @@ -106,12 +106,12 @@ type Notifications struct { } type NotificationsTemplate struct { - EmailEnabled bool `json:"emailEnabled,omitempty"` - DiscordEnabled bool `json:"discordEnabled,omitempty"` - DiscordEnabledTypes int64 `json:"discordEnabledTypes,omitempty"` - PushoverSound any `json:"pushoverSound,omitempty"` - TelegramEnabled bool `json:"telegramEnabled,omitempty"` - TelegramSendSilently any `json:"telegramSendSilently,omitempty"` - WebPushEnabled bool `json:"webPushEnabled,omitempty"` - NotifTypes *NotificationTypes `json:"notificationTypes,omitempty"` + EmailEnabled bool `json:"emailEnabled,omitempty"` + DiscordEnabled bool `json:"discordEnabled,omitempty"` + DiscordEnabledTypes int64 `json:"discordEnabledTypes,omitempty"` + PushoverSound any `json:"pushoverSound,omitempty"` + TelegramEnabled bool `json:"telegramEnabled,omitempty"` + TelegramSendSilently any `json:"telegramSendSilently,omitempty"` + WebPushEnabled bool `json:"webPushEnabled,omitempty"` + NotifTypes NotificationTypes `json:"notificationTypes"` } diff --git a/main.go b/main.go index 15f3046..c91d018 100644 --- a/main.go +++ b/main.go @@ -369,6 +369,7 @@ func start(asDaemon, firstCall bool) { app.config.Section("jellyseerr").Key("api_key").String(), common.NewTimeoutHandler("Jellyseerr", jellyseerrServer, true), ) + app.js.LogRequestBodies = true }