mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-21 22:35:24 +00:00
Add forwarding, friend controls, and benefits
Add message forwarding and reply lookup, friend removal and blocking endpoints, and database-backed Govor+ privileges with customizable profile tags. Include migrations, integration tests, and updated API and operations documentation.
This commit is contained in:
@@ -13,6 +13,17 @@ public class FriendshipService : IFriendshipService
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task RemoveFriendAsync(Guid userId, Guid currentUserId)
|
||||
{
|
||||
if (userId == Guid.Empty || currentUserId == Guid.Empty || userId == currentUserId)
|
||||
throw new ArgumentException("Two distinct users are required.");
|
||||
// A removal must never clear a block or cancel a pending request.
|
||||
await _context.Friendships.Where(f => f.Status == FriendshipStatus.Accepted &&
|
||||
((f.RequesterId == userId && f.AddresseeId == currentUserId) ||
|
||||
(f.RequesterId == currentUserId && f.AddresseeId == userId)))
|
||||
.ExecuteUpdateAsync(s => s.SetProperty(f => f.Status, FriendshipStatus.Rejected));
|
||||
}
|
||||
|
||||
public async Task<List<User>> SearchUsersAsync(string query, Guid currentId)
|
||||
{
|
||||
@@ -59,4 +70,4 @@ public class FriendshipService : IFriendshipService
|
||||
|
||||
return friends;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user