Update routes/sendnotifications.py
Browse files
routes/sendnotifications.py
CHANGED
@@ -38,9 +38,9 @@ class NotificationRequest(BaseModel):
|
|
38 |
target_user_id: str
|
39 |
reference: str = ""
|
40 |
|
41 |
-
def short_collapse_key(
|
42 |
-
raw = f"
|
43 |
-
return hashlib.sha1(raw.encode()).hexdigest()[:20]
|
44 |
|
45 |
async def verify_user_token(user_token: str) -> str:
|
46 |
headers = {
|
@@ -180,7 +180,7 @@ async def send_notification(
|
|
180 |
raise HTTPException(status_code=404, detail="User not found")
|
181 |
actor_name = format_name(actor_info["name"])
|
182 |
|
183 |
-
collapse_id = short_collapse_key(follower_id, target_user_id)
|
184 |
|
185 |
# Monta conteúdo da notificação
|
186 |
if data.keyword == "follow":
|
|
|
38 |
target_user_id: str
|
39 |
reference: str = ""
|
40 |
|
41 |
+
def short_collapse_key(keyword: str, sender_id: str, receiver_id: str) -> str:
|
42 |
+
raw = f"{keyword}:{sender_id}:{receiver_id}"
|
43 |
+
return hashlib.sha1(raw.encode()).hexdigest()[:20]
|
44 |
|
45 |
async def verify_user_token(user_token: str) -> str:
|
46 |
headers = {
|
|
|
180 |
raise HTTPException(status_code=404, detail="User not found")
|
181 |
actor_name = format_name(actor_info["name"])
|
182 |
|
183 |
+
collapse_id = short_collapse_key(data.keyword, follower_id, target_user_id)
|
184 |
|
185 |
# Monta conteúdo da notificação
|
186 |
if data.keyword == "follow":
|