mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-10 04:10: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:
parent
769a7c45da
commit
35f8337a36
@ -356,9 +356,10 @@ func (js *Jellyseerr) GetNotificationPreferencesByID(jellyseerrID int64) (Notifi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (js *Jellyseerr) ApplyNotificationsTemplateToUser(jfID string, tmpl NotificationsTemplate) error {
|
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
|
tmpl.NotifTypes = nil
|
||||||
}
|
}*/
|
||||||
u, err := js.MustGetUser(jfID)
|
u, err := js.MustGetUser(jfID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -71,19 +71,19 @@ type permissionsDTO struct {
|
|||||||
type Permissions int
|
type Permissions int
|
||||||
|
|
||||||
type NotificationTypes struct {
|
type NotificationTypes struct {
|
||||||
Discord int64 `json:"discord,omitempty"`
|
Discord int64 `json:"discord"`
|
||||||
Email int64 `json:"email,omitempty"`
|
Email int64 `json:"email"`
|
||||||
Pushbullet int64 `json:"pushbullet,omitempty"`
|
Pushbullet int64 `json:"pushbullet"`
|
||||||
Pushover int64 `json:"pushover,omitempty"`
|
Pushover int64 `json:"pushover"`
|
||||||
Slack int64 `json:"slack,omitempty"`
|
Slack int64 `json:"slack"`
|
||||||
Telegram int64 `json:"telegram,omitempty"`
|
Telegram int64 `json:"telegram"`
|
||||||
Webhook int64 `json:"webhook,omitempty"`
|
Webhook int64 `json:"webhook"`
|
||||||
Webpush int64 `json:"webpush,omitempty"`
|
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
|
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
|
type NotificationsField string
|
||||||
|
|
||||||
@ -106,12 +106,12 @@ type Notifications struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NotificationsTemplate struct {
|
type NotificationsTemplate struct {
|
||||||
EmailEnabled bool `json:"emailEnabled,omitempty"`
|
EmailEnabled bool `json:"emailEnabled,omitempty"`
|
||||||
DiscordEnabled bool `json:"discordEnabled,omitempty"`
|
DiscordEnabled bool `json:"discordEnabled,omitempty"`
|
||||||
DiscordEnabledTypes int64 `json:"discordEnabledTypes,omitempty"`
|
DiscordEnabledTypes int64 `json:"discordEnabledTypes,omitempty"`
|
||||||
PushoverSound any `json:"pushoverSound,omitempty"`
|
PushoverSound any `json:"pushoverSound,omitempty"`
|
||||||
TelegramEnabled bool `json:"telegramEnabled,omitempty"`
|
TelegramEnabled bool `json:"telegramEnabled,omitempty"`
|
||||||
TelegramSendSilently any `json:"telegramSendSilently,omitempty"`
|
TelegramSendSilently any `json:"telegramSendSilently,omitempty"`
|
||||||
WebPushEnabled bool `json:"webPushEnabled,omitempty"`
|
WebPushEnabled bool `json:"webPushEnabled,omitempty"`
|
||||||
NotifTypes *NotificationTypes `json:"notificationTypes,omitempty"`
|
NotifTypes NotificationTypes `json:"notificationTypes"`
|
||||||
}
|
}
|
||||||
|
1
main.go
1
main.go
@ -369,6 +369,7 @@ func start(asDaemon, firstCall bool) {
|
|||||||
app.config.Section("jellyseerr").Key("api_key").String(),
|
app.config.Section("jellyseerr").Key("api_key").String(),
|
||||||
common.NewTimeoutHandler("Jellyseerr", jellyseerrServer, true),
|
common.NewTimeoutHandler("Jellyseerr", jellyseerrServer, true),
|
||||||
)
|
)
|
||||||
|
app.js.LogRequestBodies = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user