refactor: moves notification toggle to individual code block
This commit is contained in:
parent
0f42096e87
commit
7effd9db7a
1 changed files with 3 additions and 5 deletions
|
|
@ -141,16 +141,14 @@ class User(Document):
|
|||
|
||||
if not cint(self.enabled):
|
||||
self.a_system_manager_should_exist()
|
||||
# disable notifications if the user has been disabled
|
||||
toggle_notifications(self.name, enable=False)
|
||||
else:
|
||||
# enable notifications if the user has been enabled
|
||||
toggle_notifications(self.name, enable=True)
|
||||
|
||||
# clear sessions if disabled
|
||||
if not cint(self.enabled) and getattr(frappe.local, "login_manager", None):
|
||||
frappe.local.login_manager.logout(user=self.name)
|
||||
|
||||
# toggle notifications based on the user's status
|
||||
toggle_notifications(self.name, enable=cint(self.enabled))
|
||||
|
||||
def add_system_manager_role(self):
|
||||
# if adding system manager, do nothing
|
||||
if not cint(self.enabled) or ("System Manager" in [user_role.role for user_role in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue