1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

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.
This commit is contained in:
Harvey Tindall 2024-07-30 16:53:40 +01:00
parent 769a7c45da
commit 35f8337a36
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
3 changed files with 22 additions and 20 deletions

View File

@ -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

View File

@ -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
@ -113,5 +113,5 @@ type NotificationsTemplate struct {
TelegramEnabled bool `json:"telegramEnabled,omitempty"`
TelegramSendSilently any `json:"telegramSendSilently,omitempty"`
WebPushEnabled bool `json:"webPushEnabled,omitempty"`
NotifTypes *NotificationTypes `json:"notificationTypes,omitempty"`
NotifTypes NotificationTypes `json:"notificationTypes"`
}

View File

@ -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
}