🤬
  • Notification system update - set watch to use defaults if it is the same as the default

  • Loading...
  • dgtlmoon committed 2 years ago
    e154a3cb
    1 parent 12627002
  • ■ ■ ■ ■ ■ ■
    changedetectionio/store.py
    skipped 536 lines
    537 537   continue
    538 538   return
    539 539   
     540 + def update_5(self):
     541 + # If the watch notification body, title look the same as the global one, unset it, so the watch defaults back to using the main settings
     542 + # In other words - the watch notification_title and notification_body are not needed if they are the same as the default one
     543 + current_system_body = self.data['settings']['application']['notification_body'].translate(str.maketrans('', '', "\r\n "))
     544 + current_system_title = self.data['settings']['application']['notification_body'].translate(str.maketrans('', '', "\r\n "))
     545 + for uuid, watch in self.data['watching'].items():
     546 + try:
     547 + watch_body = watch.get('notification_body', '')
     548 + if watch_body and watch_body.translate(str.maketrans('', '', "\r\n ")) == current_system_body:
     549 + # Looks the same as the default one, so unset it
     550 + watch['notification_body'] = None
     551 + 
     552 + watch_title = watch.get('notification_title', '')
     553 + if watch_title and watch_title.translate(str.maketrans('', '', "\r\n ")) == current_system_title:
     554 + # Looks the same as the default one, so unset it
     555 + watch['notification_title'] = None
     556 + except Exception as e:
     557 + continue
     558 + return
     559 + 
     560 + 
Please wait...
Page is in error, reload to recover