@@ -55,15 +55,21 @@ def like_profile(uid):
5555 if u .already_likes (current_user .id ):
5656 Match .create (user_1 = current_user .id , user_2 = u .id )
5757 Notification .create (
58- user_id = u .id , content = f"{ u .first_name } liked you! Go check them out!" , type = "like" , link_to = f"users/{ u .id } "
58+ trigger_id = current_user .id ,
59+ user_id = u .id ,
60+ content = f"{ current_user .first_name } liked you! Go check them out!" ,
61+ type = "like" ,
62+ link_to = f"users/{ current_user .id } " ,
5963 )
6064 Notification .create (
65+ trigger_id = current_user .id ,
6166 user_id = u .id ,
6267 content = f"You and { current_user .first_name } matched!" ,
6368 type = "match" ,
6469 link_to = f"conversation/{ current_user .id } " ,
6570 )
6671 Notification .create (
72+ trigger_id = u .id ,
6773 user_id = current_user .id ,
6874 content = f"You and { u .first_name } matched!" ,
6975 type = "match" ,
@@ -73,15 +79,20 @@ def like_profile(uid):
7379
7480 if is_superlike :
7581 Notification .create (
82+ trigger_id = current_user .id ,
7683 user_id = u .id ,
77- content = f"{ u .first_name } superliked you 😏! Go check them out!" ,
84+ content = f"{ current_user .first_name } superliked you 😏! Go check them out!" ,
7885 type = "superlike" ,
79- link_to = f"users/{ u .id } " ,
86+ link_to = f"users/{ current_user .id } " ,
8087 )
8188 return Success ("Superliked user." )
8289 else :
8390 Notification .create (
84- user_id = u .id , content = f"{ u .first_name } liked you! Go check them out!" , type = "like" , link_to = f"users/{ u .id } "
91+ trigger_id = current_user .id ,
92+ user_id = u .id ,
93+ content = f"{ current_user .first_name } liked you! Go check them out!" ,
94+ type = "like" ,
95+ link_to = f"users/{ current_user .id } " ,
8596 )
8697 return Success ("Liked user." )
8798
@@ -99,6 +110,12 @@ def unlike_profile(uid):
99110 raise BadRequestError ("You never liked this person in the first place." )
100111 Like .get_multi (liked_id = u .id , liker_id = current_user .id ).delete ()
101112
102- Notification .create (user_id = u .id , content = f"{ u .first_name } unliked you." , type = "unlike" , link_to = None )
113+ Notification .create (
114+ trigger_id = current_user .id ,
115+ user_id = u .id ,
116+ content = f"{ current_user .first_name } unliked you." ,
117+ type = "unlike" ,
118+ link_to = None ,
119+ )
103120
104121 return Success (f"Unliked user { u .id } ." )
0 commit comments