🐛 Fix user prevention wrong logic

This commit is contained in:
LittleSheep 2024-04-06 02:08:46 +08:00
parent e7e86fa7c6
commit bc688f61d3

View File

@ -81,9 +81,9 @@ func editFriendship(c *fiber.Ctx) error {
friendship, err := services.GetFriendWithTwoSides(user.ID, related.ID)
if err != nil {
return fiber.NewError(fiber.StatusNotFound, err.Error())
} else if friendship.Status == models.FriendshipPending || data.Status == uint8(models.FriendshipPending) {
} else if friendship.Status == models.FriendshipPending && data.Status == uint8(models.FriendshipActive) {
if friendship.RelatedID != user.ID {
return fiber.NewError(fiber.StatusNotFound, "only related person can accept or revoke accept friendship")
return fiber.NewError(fiber.StatusNotFound, "only related person can accept friendship")
}
}