Merge pull request #17024 from gavindsouza/misc-fixes-9
fix: Update modified timestamp on Notification Settings (only when needed)
This commit is contained in:
commit
8212aefdf3
2 changed files with 10 additions and 4 deletions
|
|
@ -148,6 +148,6 @@ def trigger_indicator_hide():
|
|||
|
||||
def set_notifications_as_unseen(user):
|
||||
try:
|
||||
frappe.db.set_value("Notification Settings", user, "seen", 0)
|
||||
frappe.db.set_value("Notification Settings", user, "seen", 0, update_modified=False)
|
||||
except frappe.DoesNotExistError:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -48,9 +48,15 @@ def create_notification_settings(user):
|
|||
_doc.insert(ignore_permissions=True)
|
||||
|
||||
|
||||
def toggle_notifications(user, enable=False):
|
||||
if frappe.db.exists("Notification Settings", user):
|
||||
frappe.db.set_value("Notification Settings", user, "enabled", enable)
|
||||
def toggle_notifications(user: str, enable: bool = False):
|
||||
try:
|
||||
settings = frappe.get_doc("Notification Settings", user)
|
||||
except frappe.DoesNotExistError:
|
||||
return
|
||||
|
||||
if settings.enabled != enable:
|
||||
settings.enabled = enable
|
||||
settings.save()
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue