aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 3d2c68cd..f180e339 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -41,6 +41,7 @@ from fatcat_web.auth import (
)
from fatcat_web.cors import crossdomain
from fatcat_web.entity_helpers import (
+ editgroup_get_diffs,
generic_get_editgroup_entity,
generic_get_entity,
generic_get_entity_revision,
@@ -689,6 +690,35 @@ def editgroup_view(ident: str) -> AnyResponse:
return render_template("editgroup_view.html", editgroup=eg, auth_to=auth_to)
+@app.route("/editgroup/<string(length=26):ident>/diff", methods=["GET"])
+def editgroup_diff_view(ident: str) -> AnyResponse:
+ try:
+ eg = api.get_editgroup(str(ident))
+ eg.editor = api.get_editor(eg.editor_id)
+ eg.annotations = api.get_editgroup_annotations(eg.editgroup_id, expand="editors")
+ except ApiException as ae:
+ abort(ae.status)
+ # TODO: idomatic check for login?
+ auth_to = dict(
+ submit=False,
+ accept=False,
+ edit=False,
+ annotate=False,
+ )
+ if session.get("editor"):
+ user = load_user(session["editor"]["editor_id"])
+ auth_to["annotate"] = True
+ if user.is_admin or user.editor_id == eg.editor_id:
+ auth_to["submit"] = True
+ auth_to["edit"] = True
+ if user.is_admin:
+ auth_to["accept"] = True
+ diffs = editgroup_get_diffs(eg)
+ return render_template(
+ "editgroup_diff.html", editgroup=eg, auth_to=auth_to, editgroup_diffs=diffs
+ )
+
+
@app.route("/editgroup/<string(length=26):ident>/annotation", methods=["POST"])
@login_required
def editgroup_create_annotation(ident: str) -> AnyResponse: