From 23195571240f27d3404f4c1666787188c86d18ae Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 9 Apr 2019 11:54:16 -0700 Subject: partial checking of editgroup_id checking when editing --- python/fatcat_web/editing_routes.py | 4 +++- python/fatcat_web/routes.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py index 29db3443..c07ee81f 100644 --- a/python/fatcat_web/editing_routes.py +++ b/python/fatcat_web/editing_routes.py @@ -30,7 +30,9 @@ def form_editgroup_get_or_create(api, edit_form): return None app.log.warning(ae) abort(ae.status) - # TODO: check here that editgroup hasn't been merged already + if eg.changelog_index: + edit_form.editgroup_id.errors.append("Editgroup has already been accepted") + return None else: # if no editgroup, create one from description try: diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 422d121e..c3467a61 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -382,6 +382,9 @@ def editgroup_accept(ident): except ApiException as ae: app.log.info(ae) abort(ae.status) + # clear active_editgroup_id cookie; this doesn't cover all cases + if eg.editgroup_id == session.get('active_editgroup_id'): + session.pop('active_editgroup_id') return redirect('/editgroup/{}'.format(ident)) @app.route('/editgroup//unsubmit', methods=['POST']) -- cgit v1.2.3