fix: ignore perm while updating notification settings
If you can update user, do you should be able to update notif settings.
This commit is contained in:
parent
65e859c938
commit
d196dfeac4
2 changed files with 3 additions and 3 deletions
|
|
@ -248,7 +248,7 @@ class User(Document):
|
|||
frappe.local.login_manager.logout(user=self.name)
|
||||
|
||||
# toggle notifications based on the user's status
|
||||
toggle_notifications(self.name, enable=cint(self.enabled))
|
||||
toggle_notifications(self.name, enable=cint(self.enabled), ignore_permissions=True)
|
||||
|
||||
def add_system_manager_role(self):
|
||||
if self.is_system_manager_disabled():
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ def create_notification_settings(user):
|
|||
_doc.insert(ignore_permissions=True)
|
||||
|
||||
|
||||
def toggle_notifications(user: str, enable: bool = False):
|
||||
def toggle_notifications(user: str, enable: bool = False, ignore_permissions=False):
|
||||
try:
|
||||
settings = frappe.get_doc("Notification Settings", user)
|
||||
except frappe.DoesNotExistError:
|
||||
|
|
@ -79,7 +79,7 @@ def toggle_notifications(user: str, enable: bool = False):
|
|||
|
||||
if settings.enabled != enable:
|
||||
settings.enabled = enable
|
||||
settings.save()
|
||||
settings.save(ignore_permissions=ignore_permissions)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue