From 757f1942f0d81a1ea386187cd9d24efd9b8ade0c Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 15 Apr 2019 22:23:55 +0200 Subject: [PATCH] Add some TODOs for finishing the qestion/poll support --- app.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app.py b/app.py index b5c913d..15f20dd 100644 --- a/app.py +++ b/app.py @@ -2847,6 +2847,31 @@ def task_post_to_remote_inbox(): return "" +@app.route("/task/update_question", methods=["POST"]) +def task_update_question(): + """Post an activity to a remote inbox.""" + task = p.parse(request) + app.logger.info(f"task={task!r}") + iri = task.payload + try: + app.logger.info(f"Updating question {iri}") + # TODO(tsileo): sends an Update with the question/iri as an actor, with the updated stats (LD sig will fail?) + # but to who? followers and people who voted? but this must not be visible right? + # also sends/trigger a notification when a poll I voted for ends like Mastodon? + except HTTPError as err: + app.logger.exception("request failed") + if 400 >= err.response.status_code >= 499: + app.logger.info("client error, no retry") + return "" + + raise TaskError() from err + except Exception as err: + app.logger.exception("task failed") + raise TaskError() from err + + return "" + + @app.route("/task/cleanup", methods=["POST"]) def task_cleanup(): task = p.parse(request)