🐛 Fix cannot approve something
This commit is contained in:
		| @@ -87,6 +87,8 @@ func editFriendship(c *fiber.Ctx) error { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	friendship.Status = models.FriendshipStatus(data.Status) | ||||||
|  |  | ||||||
| 	if friendship, err := services.EditFriend(friendship); err != nil { | 	if friendship, err := services.EditFriend(friendship); err != nil { | ||||||
| 		return fiber.NewError(fiber.StatusBadRequest, err.Error()) | 		return fiber.NewError(fiber.StatusBadRequest, err.Error()) | ||||||
| 	} else { | 	} else { | ||||||
|   | |||||||
| @@ -11,9 +11,8 @@ import ( | |||||||
| func ListFriend(anyside models.Account, status models.FriendshipStatus) ([]models.AccountFriendship, error) { | func ListFriend(anyside models.Account, status models.FriendshipStatus) ([]models.AccountFriendship, error) { | ||||||
| 	var relationships []models.AccountFriendship | 	var relationships []models.AccountFriendship | ||||||
| 	if err := database.C. | 	if err := database.C. | ||||||
| 		Where(&models.AccountFriendship{Status: status}). | 		Where(&models.AccountFriendship{AccountID: anyside.ID, Status: status}). | ||||||
| 		Where(&models.AccountFriendship{AccountID: anyside.ID}). | 		Or(&models.AccountFriendship{RelatedID: anyside.ID, Status: status}). | ||||||
| 		Or(&models.AccountFriendship{RelatedID: anyside.ID}). |  | ||||||
| 		Preload("Account"). | 		Preload("Account"). | ||||||
| 		Preload("Related"). | 		Preload("Related"). | ||||||
| 		Find(&relationships).Error; err != nil { | 		Find(&relationships).Error; err != nil { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user