aboutsummaryrefslogtreecommitdiff
path: root/api/social
diff options
context:
space:
mode:
Diffstat (limited to 'api/social')
-rw-r--r--api/social/destroy_relation.py7
-rw-r--r--api/social/friend_accept.py4
2 files changed, 10 insertions, 1 deletions
diff --git a/api/social/destroy_relation.py b/api/social/destroy_relation.py
index 09b42f0..a08175f 100644
--- a/api/social/destroy_relation.py
+++ b/api/social/destroy_relation.py
@@ -3,6 +3,7 @@ from db import cursor
from auth.login_token import token_login
from social.create_relation import remove_relation
from user.info import get_relation_to
+from socket_io import io
import time
remove = Blueprint('remove', __name__)
@@ -22,10 +23,14 @@ def index():
return "", 403
relation = get_relation_to(user_1_id, user_2_id)
- if relation == "none": return 403
+ if relation == "none": return "", 403
remove_relation(user_1_id, user_2_id)
remove_relation(user_2_id, user_1_id)
+
+ io.emit("changedRelation", { "id": user_2_id }, room="user-"+user_1_id)
+ io.emit("changedRelation", { "id": user_1_id }, room="user-"+user_2_id)
+
return "", 200
unblock = Blueprint('unblock', __name__)
diff --git a/api/social/friend_accept.py b/api/social/friend_accept.py
index bc850d2..8340274 100644
--- a/api/social/friend_accept.py
+++ b/api/social/friend_accept.py
@@ -1,6 +1,7 @@
from flask import Blueprint, request
from db import cursor, connection
from auth.login_token import token_login
+from socket_io import io
import time
accept = Blueprint('accept', __name__)
@@ -23,6 +24,9 @@ def route():
[user_1_id, user_2_id])
connection.commit()
+ io.emit("changedRelation", { "id": user_2_id }, room="user-"+user_1_id)
+ io.emit("changedRelation", { "id": user_1_id }, room="user-"+user_2_id)
+
return "", 200
dynamic_route = ["/social", accept]