mirror of
https://github.com/frappe/frappe.git
synced 2024-06-12 23:12:20 +00:00
refactor: misc changes
- Move sys setting check to server side - tomli import handling
This commit is contained in:
parent
e0c171b23b
commit
a234e79790
|
@ -23,7 +23,7 @@ from frappe.social.doctype.energy_point_settings.energy_point_settings import (
|
|||
is_energy_point_enabled,
|
||||
)
|
||||
from frappe.utils import add_user_info, cstr, get_system_timezone
|
||||
from frappe.utils.change_log import get_versions, has_app_update_notifications
|
||||
from frappe.utils.change_log import get_versions
|
||||
from frappe.utils.frappecloud import on_frappecloud
|
||||
from frappe.website.doctype.web_page_view.web_page_view import is_tracking_enabled
|
||||
|
||||
|
@ -109,7 +109,6 @@ def get_bootinfo():
|
|||
bootinfo.subscription_conf = add_subscription_conf()
|
||||
bootinfo.marketplace_apps = get_marketplace_apps()
|
||||
bootinfo.changelog_feed = get_changelog_feed_items()
|
||||
bootinfo.has_app_updates = has_app_update_notifications()
|
||||
|
||||
return bootinfo
|
||||
|
||||
|
|
|
@ -436,11 +436,7 @@ frappe.Application = class Application {
|
|||
}
|
||||
|
||||
show_update_available() {
|
||||
if (
|
||||
!frappe.boot.has_app_updates ||
|
||||
cint(frappe.boot.sysdefaults.disable_system_update_notification)
|
||||
)
|
||||
return;
|
||||
if (!frappe.boot.has_app_updates) return;
|
||||
frappe.xcall("frappe.utils.change_log.show_update_popup");
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ from frappe import _
|
|||
from frappe.cache_manager import clear_user_cache
|
||||
from frappe.query_builder import Order
|
||||
from frappe.utils import cint, cstr, get_assets_json
|
||||
from frappe.utils.change_log import has_app_update_notifications
|
||||
from frappe.utils.data import add_to_date
|
||||
|
||||
|
||||
|
@ -169,6 +170,7 @@ def get():
|
|||
bootinfo["desk_theme"] = frappe.db.get_value("User", frappe.session.user, "desk_theme") or "Light"
|
||||
bootinfo["user"]["impersonated_by"] = frappe.session.data.get("impersonated_by")
|
||||
bootinfo["navbar_settings"] = frappe.get_cached_doc("Navbar Settings")
|
||||
bootinfo.has_app_updates = has_app_update_notifications()
|
||||
|
||||
return bootinfo
|
||||
|
||||
|
|
|
@ -164,6 +164,9 @@ def get_app_last_commit_ref(app):
|
|||
|
||||
|
||||
def check_for_update():
|
||||
if frappe.get_system_settings("disable_system_update_notification"):
|
||||
return
|
||||
|
||||
updates = frappe._dict(major=[], minor=[], patch=[])
|
||||
apps = get_versions()
|
||||
|
||||
|
@ -306,6 +309,8 @@ def add_message_to_redis(update_json):
|
|||
|
||||
@frappe.whitelist()
|
||||
def show_update_popup():
|
||||
if frappe.get_system_settings("disable_system_update_notification"):
|
||||
return
|
||||
user = frappe.session.user
|
||||
|
||||
update_info = frappe.cache.get_value("update-info")
|
||||
|
@ -365,18 +370,12 @@ def show_update_popup():
|
|||
|
||||
|
||||
def get_pyproject(app: str) -> dict | None:
|
||||
from tomli import load
|
||||
|
||||
pyproject_path = frappe.get_app_path(app, "..", "pyproject.toml")
|
||||
|
||||
if not os.path.exists(pyproject_path):
|
||||
return None
|
||||
|
||||
try:
|
||||
from tomli import load
|
||||
except ImportError:
|
||||
try:
|
||||
from tomllib import load
|
||||
except ImportError:
|
||||
return None
|
||||
|
||||
with open(pyproject_path, "rb") as f:
|
||||
return load(f)
|
||||
|
|
Loading…
Reference in New Issue
Block a user