fix: reduce api call

This commit is contained in:
hrwx 2021-11-29 17:28:40 +00:00
parent fa317538a9
commit db4476fc5f
3 changed files with 14 additions and 12 deletions

View file

@ -466,6 +466,7 @@
"label": "Encrypt Backups"
},
{
"collapsible": 1,
"fieldname": "system_updates_section",
"fieldtype": "Section Break",
"label": "System Updates"
@ -480,7 +481,7 @@
"icon": "fa fa-cog",
"issingle": 1,
"links": [],
"modified": "2021-11-27 01:17:05.228959",
"modified": "2021-11-29 18:09:53.601629",
"modified_by": "Administrator",
"module": "Core",
"name": "System Settings",

View file

@ -531,6 +531,8 @@ frappe.Application = class Application {
}
show_update_available() {
if (frappe.boot.sysdefaults.disable_system_update_notification) return;
frappe.call({
"method": "frappe.utils.change_log.show_update_popup"
});

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),
available_version = str(github_version),
org_name = org_name,
app_name = app,
title = apps[app]['title'],
current_version=str(instance_version),
available_version=str(github_version),
org_name=org_name,
app_name=app,
title=apps[app]['title'],
))
break
if github_version.__dict__[update_type] < instance_version.__dict__[update_type]: break
@ -243,10 +243,9 @@ def add_message_to_redis(update_json):
def show_update_popup():
cache = frappe.cache()
user = frappe.session.user
system_settings = frappe.get_single("System Settings")
update_info = cache.get_value("update-info")
if not update_info or system_settings.disable_system_update_notification:
if not update_info:
return
updates = json.loads(update_info)
@ -259,10 +258,10 @@ def show_update_popup():
for app in updates[update_type]:
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
available_version=app.available_version,
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))