Prevent users from hearting themselves

This commit is contained in:
Slendy 2023-06-17 15:11:26 -05:00
commit 425245fd07
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -122,6 +122,8 @@ public partial class DatabaseContext
public async Task HeartUser(int userId, UserEntity heartedUser) public async Task HeartUser(int userId, UserEntity heartedUser)
{ {
if (userId == heartedUser.UserId) return;
HeartedProfileEntity? heartedProfile = await this.HeartedProfiles.FirstOrDefaultAsync(q => q.UserId == userId && q.HeartedUserId == heartedUser.UserId); HeartedProfileEntity? heartedProfile = await this.HeartedProfiles.FirstOrDefaultAsync(q => q.UserId == userId && q.HeartedUserId == heartedUser.UserId);
if (heartedProfile != null) return; if (heartedProfile != null) return;