Add IsAvailable property to Inbound and update related logic
- Introduced a new boolean property, `IsAvailable`, to the `Inbound` entity to track the availability status of inbounds based on synchronization results. - Updated the `SyncNodeCommandHandler` to mark inbounds as unavailable if they are not present in the latest synchronization but have existing configurations, preventing their deletion. - Enhanced the `MarkUnavailable` method to set both `IsAvailable` and `IsPublished` to false, reflecting the new status accurately. - Modified the frontend components to display the availability status of inbounds, ensuring users are informed of their current state. - Updated tests to cover the new behavior regarding inbound availability and its impact on revocation processes.
This commit is contained in:
@@ -60,4 +60,24 @@ public class InboundTests
|
||||
Assert.False(inbound.IsPublished);
|
||||
Assert.Contains(roleId, inbound.AllowedRoleIds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FromRemote_CreatesAvailableInbound()
|
||||
{
|
||||
var inbound = Inbound.FromRemote(Guid.NewGuid(), "12", VpnProtocol.Vless, "Germany", 443);
|
||||
|
||||
Assert.True(inbound.IsAvailable);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MarkUnavailable_SetsIsAvailableAndIsPublishedFalse()
|
||||
{
|
||||
var inbound = Inbound.FromRemote(Guid.NewGuid(), "12", VpnProtocol.Vless, "Germany", 443);
|
||||
inbound.Publish("Germany", [Guid.NewGuid()]);
|
||||
|
||||
inbound.MarkUnavailable();
|
||||
|
||||
Assert.False(inbound.IsAvailable);
|
||||
Assert.False(inbound.IsPublished);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user