Merge pull request #505 from YunoHost/app_actions2

[mod] information needed for the admin UI
This commit is contained in:
Bram 2018-07-03 00:55:24 +02:00 committed by GitHub
commit 03f52bdd69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1369,14 +1369,14 @@ def app_change_label(auth, app, new_label):
def app_action_list(app_id): def app_action_list(app_id):
logger.warning(m18n.n('experimental_feature')) logger.warning(m18n.n('experimental_feature'))
installed = _is_installed(app_id) # this will take care of checking if the app is installed
if not installed: app_info_dict = app_info(app_id)
raise MoulinetteError(errno.ENOPKG,
m18n.n('app_not_installed', app=app_id))
actions = os.path.join(APPS_SETTING_PATH, app_id, 'actions.json') actions = os.path.join(APPS_SETTING_PATH, app_id, 'actions.json')
return { return {
"app_id": app_id,
"app_name": app_info_dict["name"],
"actions": read_json(actions) if os.path.exists(actions) else [], "actions": read_json(actions) if os.path.exists(actions) else [],
} }