Merge pull request #1123 from YunoHost/fix-app-info-name-label

[fix] key name of app label wasn't the real label
This commit is contained in:
Alexandre Aubin 2021-01-01 18:46:33 +01:00 committed by GitHub
commit d31ba05a26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,12 +154,13 @@ def app_info(app, full=False):
raise YunohostError('app_not_installed', app=app, all_apps=_get_all_installed_apps_id())
local_manifest = _get_manifest_of_app(os.path.join(APPS_SETTING_PATH, app))
permissions = user_permission_list(full=True, absolute_urls=True)["permissions"]
settings = _get_app_settings(app)
ret = {
'description': _value_for_locale(local_manifest['description']),
'name': local_manifest['name'],
'name': permissions.get(app + ".main", {}).get("label", local_manifest['name']),
'version': local_manifest.get('version', '-'),
}
@ -180,9 +181,10 @@ def app_info(app, full=False):
ret['supports_backup_restore'] = (os.path.exists(os.path.join(APPS_SETTING_PATH, app, "scripts", "backup")) and
os.path.exists(os.path.join(APPS_SETTING_PATH, app, "scripts", "restore")))
ret['supports_multi_instance'] = is_true(local_manifest.get("multi_instance", False))
permissions = user_permission_list(full=True, absolute_urls=True)["permissions"]
ret['permissions'] = {p: i for p, i in permissions.items() if p.startswith(app + ".")}
ret['label'] = permissions.get(app + ".main", {}).get("label")
if not ret['label']:
logger.warning("Failed to get label for app %s ?" % app)
return ret