1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-05-28 01:15:43 +02:00

Fix sync display name and delete after issue

This commit is contained in:
binwiederhier 2023-01-24 15:05:19 -05:00
parent 3e48c86ee9
commit eecd689ad5
4 changed files with 16 additions and 15 deletions

View file

@ -72,8 +72,8 @@ func (s *Server) handleAccountGet(w http.ResponseWriter, _ *http.Request, v *vis
response.Role = string(v.user.Role)
response.SyncTopic = v.user.SyncTopic
if v.user.Prefs != nil {
if v.user.Prefs.Language != "" {
response.Language = v.user.Prefs.Language
if v.user.Prefs.Language != nil {
response.Language = *v.user.Prefs.Language
}
if v.user.Prefs.Notification != nil {
response.Notification = v.user.Prefs.Notification
@ -210,20 +210,20 @@ func (s *Server) handleAccountSettingsChange(w http.ResponseWriter, r *http.Requ
v.user.Prefs = &user.Prefs{}
}
prefs := v.user.Prefs
if newPrefs.Language != "" {
if newPrefs.Language != nil {
prefs.Language = newPrefs.Language
}
if newPrefs.Notification != nil {
if prefs.Notification == nil {
prefs.Notification = &user.NotificationPrefs{}
}
if newPrefs.Notification.DeleteAfter > 0 {
if newPrefs.Notification.DeleteAfter != nil {
prefs.Notification.DeleteAfter = newPrefs.Notification.DeleteAfter
}
if newPrefs.Notification.Sound != "" {
if newPrefs.Notification.Sound != nil {
prefs.Notification.Sound = newPrefs.Notification.Sound
}
if newPrefs.Notification.MinPriority > 0 {
if newPrefs.Notification.MinPriority != nil {
prefs.Notification.MinPriority = newPrefs.Notification.MinPriority
}
}