mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-29 15:50:36 +02:00
Fix sync display name and delete after issue
This commit is contained in:
parent
3e48c86ee9
commit
eecd689ad5
4 changed files with 16 additions and 15 deletions
|
@ -1328,6 +1328,7 @@ func (s *Server) execManager() {
|
|||
var subscribers int
|
||||
for _, t := range s.topics {
|
||||
subs := t.SubscribersCount()
|
||||
log.Trace("- topic %s: %d subscribers", t.ID, subs)
|
||||
msgs, exists := messageCounts[t.ID]
|
||||
if subs == 0 && (!exists || msgs == 0) {
|
||||
log.Trace("Deleting empty topic %s", t.ID)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ func (t *topic) Publish(v *visitor, m *message) error {
|
|||
// we don't want individual slow subscribers to be able to block others.
|
||||
go func(s subscriber) {
|
||||
if err := s(v, m); err != nil {
|
||||
log.Warn("%s Error forwarding to subscriber", logMessagePrefix(v, m))
|
||||
log.Warn("%s Error forwarding to subscriber: %s", logMessagePrefix(v, m), err.Error())
|
||||
}
|
||||
}(s.subscriber)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue