habulaj commited on
Commit
f05e997
·
verified ·
1 Parent(s): 4f04102

Update routes/sendnotifications.py

Browse files
Files changed (1) hide show
  1. routes/sendnotifications.py +4 -4
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(follower_id: str, target_user_id: str) -> str:
42
- raw = f"follow:{follower_id}:{target_user_id}"
43
- return hashlib.sha1(raw.encode()).hexdigest()[:20] # 20 chars = 40 hex bytes
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":