From 23eda1352fc1199396e68171b666f7eef0c64557 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Fri, 22 Mar 2024 04:47:57 +0100 Subject: [PATCH] store: show error if the app is already in the catalog on wishlist submission --- store/app.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/store/app.py b/store/app.py index af4b346b..1b55c51b 100644 --- a/store/app.py +++ b/store/app.py @@ -348,6 +348,23 @@ def add_to_wishlist(): ), ) + app_catalog = get_catalog()["apps"] + + if slug in app_catalog: + url = f"https://apps.yunohost.org/app/{slug}" + return render_template( + "wishlist_add.html", + locale=get_locale(), + user=session.get("user", {}), + csrf_token=csrf_token, + successmsg=None, + errormsg=_( + "An app with the name %(slug)s already exists in the catalog, you can see its page here.", + slug=slug, + url=url, + ), + ) + new_wishlist[slug] = { "name": name, "description": description,