aboutsummaryrefslogtreecommitdiff
path: root/api/social
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-03-13 14:26:23 +0100
committerlonkaars <l.leblansch@gmail.com>2021-03-13 14:26:23 +0100
commitda23936687d21999541611b0480385b412ee6a00 (patch)
treeeff53281e48ac3c6287e7e59ccacc635ca4cc6b3 /api/social
parent5484abefebb0464158e872be7bbf44a2b1ac3aed (diff)
unblock route working
Diffstat (limited to 'api/social')
-rw-r--r--api/social/destroy_relation.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/api/social/destroy_relation.py b/api/social/destroy_relation.py
index aac6360..09b42f0 100644
--- a/api/social/destroy_relation.py
+++ b/api/social/destroy_relation.py
@@ -28,5 +28,29 @@ def index():
remove_relation(user_2_id, user_1_id)
return "", 200
-dynamic_route = ["/social", remove]
+unblock = Blueprint('unblock', __name__)
+
+@unblock.route('/unblock', methods = ['POST'])
+def index():
+ data = request.get_json()
+
+ user_2_id = data.get("id") or ""
+ token = request.cookies.get("token") or ""
+
+ if not token: return "", 401
+ user_1_id = token_login(token) or ""
+
+ if not user_1_id or \
+ not user_2_id:
+ return "", 403
+
+ if get_relation_to(user_1_id, user_2_id) != "blocked": return "", 403
+
+ remove_relation(user_1_id, user_2_id)
+ return "", 200
+
+dynamic_routes = [
+ ["/social", remove],
+ ["/social", unblock]
+ ]