From bafd426eaf62c4f76362215e684b8913a0e7178c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 29 Jan 2019 18:30:30 +0000 Subject: [PATCH] Add automatic approval of releases and screenshots --- app/views/packages/releases.py | 2 ++ app/views/packages/screenshots.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/packages/releases.py b/app/views/packages/releases.py index 7bc9b09b..45935e38 100644 --- a/app/views/packages/releases.py +++ b/app/views/packages/releases.py @@ -85,6 +85,7 @@ def create_release_page(package): rel.task_id = uuid() rel.min_rel = form["min_rel"].data.getActual() rel.max_rel = form["max_rel"].data.getActual() + rel.approved = package.checkPerm(current_user, Permission.APPROVE_RELEASE) db.session.add(rel) db.session.commit() @@ -104,6 +105,7 @@ def create_release_page(package): rel.url = uploadedPath rel.min_rel = form["min_rel"].data.getActual() rel.max_rel = form["max_rel"].data.getActual() + rel.approved = package.checkPerm(current_user, Permission.APPROVE_RELEASE) db.session.add(rel) db.session.commit() diff --git a/app/views/packages/screenshots.py b/app/views/packages/screenshots.py index 0e63af80..cba70306 100644 --- a/app/views/packages/screenshots.py +++ b/app/views/packages/screenshots.py @@ -53,9 +53,10 @@ def create_screenshot_page(package, id=None): "a PNG or JPG image file") if uploadedPath is not None: ss = PackageScreenshot() - ss.package = package - ss.title = form["title"].data or "Untitled" - ss.url = uploadedPath + ss.package = package + ss.title = form["title"].data or "Untitled" + ss.url = uploadedPath + ss.approved = package.checkPerm(current_user, Permission.APPROVE_SCREENSHOT) db.session.add(ss) msg = "{}: Screenshot added {}" \