feat: add option to disable notification

This commit is contained in:
hrwx 2021-11-27 00:24:21 +00:00
parent 55103a92e6
commit ae31a0d6fb
2 changed files with 25 additions and 11 deletions

View file

@ -66,7 +66,9 @@
"attach_view_link",
"prepared_report_section",
"enable_prepared_report_auto_deletion",
"prepared_report_expiry_period"
"prepared_report_expiry_period",
"system_updates_section",
"disable_system_update_notification"
],
"fields": [
{
@ -462,12 +464,23 @@
"fieldname": "encrypt_backup",
"fieldtype": "Check",
"label": "Encrypt Backups"
},
{
"fieldname": "system_updates_section",
"fieldtype": "Section Break",
"label": "System Updates"
},
{
"default": "0",
"fieldname": "disable_system_update_notification",
"fieldtype": "Check",
"label": "Disable System Update Notification"
}
],
"icon": "fa fa-cog",
"issingle": 1,
"links": [],
"modified": "2021-10-21 19:24:15.232430",
"modified": "2021-11-27 01:17:05.228959",
"modified_by": "Administrator",
"module": "Core",
"name": "System Settings",

View file

@ -155,11 +155,11 @@ def check_for_update():
for update_type in updates:
if github_version.__dict__[update_type] > instance_version.__dict__[update_type]:
updates[update_type].append(frappe._dict(
current_version = str(instance_version),
current_version = str(instance_version),
available_version = str(github_version),
org_name = org_name,
app_name = app,
title = apps[app]['title'],
org_name = org_name,
app_name = app,
title = apps[app]['title'],
))
break
if github_version.__dict__[update_type] < instance_version.__dict__[update_type]: break
@ -242,10 +242,11 @@ def add_message_to_redis(update_json):
@frappe.whitelist()
def show_update_popup():
cache = frappe.cache()
user = frappe.session.user
user = frappe.session.user
system_settings = frappe.get_single("System Settings")
update_info = cache.get_value("update-info")
if not update_info:
if not update_info or system_settings.disable_system_update_notification:
return
updates = json.loads(update_info)
@ -259,9 +260,9 @@ def show_update_popup():
app = frappe._dict(app)
release_links += "<b>{title}</b>: <a href='https://github.com/{org_name}/{app_name}/releases/tag/v{available_version}'>v{available_version}</a><br>".format(
available_version = app.available_version,
org_name = app.org_name,
app_name = app.app_name,
title = app.title
org_name = app.org_name,
app_name = app.app_name,
title = app.title
)
if release_links:
message = _("New {} releases for the following apps are available").format(_(update_type))