fixed can't set notifications settings to false

This commit is contained in:
Andy Pack 2022-12-10 08:26:19 +00:00
parent 7a907e918c
commit b8fea8a68e
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7

View File

@ -231,19 +231,27 @@ def user_route(auth: dict = None, user: User = None):
else: else:
logger.info(f'skipping duplicate apns token {user.username} -> {apns_token}') logger.info(f'skipping duplicate apns token {user.username} -> {apns_token}')
if notify := request_json.get('notify'): if 'notify' in request_json:
notify = request_json['notify']
logger.info(f'updating notification settings for {user.username} -> {notify}') logger.info(f'updating notification settings for {user.username} -> {notify}')
user.notify = notify user.notify = notify
if notify_playlist_updates := request_json.get('notify_playlist_updates'): if 'notify_playlist_updates' in request_json:
notify_playlist_updates = request_json['notify_playlist_updates']
logger.info(f'updating playlist update notification settings for {user.username} -> {notify_playlist_updates}') logger.info(f'updating playlist update notification settings for {user.username} -> {notify_playlist_updates}')
user.notify_playlist_updates = notify_playlist_updates user.notify_playlist_updates = notify_playlist_updates
if notify_tag_updates := request_json.get('notify_tag_updates'): if 'notify_tag_updates' in request_json:
notify_tag_updates = request_json['notify_tag_updates']
logger.info(f'updating playlist update notification settings for {user.username} -> {notify_tag_updates}') logger.info(f'updating playlist update notification settings for {user.username} -> {notify_tag_updates}')
user.notify_tag_updates = notify_tag_updates user.notify_tag_updates = notify_tag_updates
if notify_admins := request_json.get('notify_admins'): if 'notify_admins' in request_json:
notify_admins = request_json['notify_admins']
logger.info(f'updating admin notification settings for {user.username} -> {notify_admins}') logger.info(f'updating admin notification settings for {user.username} -> {notify_admins}')
user.notify_admins = notify_admins user.notify_admins = notify_admins