api cleanup, decline message on notification decline

This commit is contained in:
choco
2025-10-20 21:16:30 +02:00
parent 4f5ef8ff4b
commit 147baa4c1b
3 changed files with 6 additions and 4 deletions

View File

@@ -568,7 +568,7 @@ public class NotificationService : DisposableMediatorSubscriberBase, IHostedServ
senderName,
request.HashedCid,
onAccept: () => _pairRequestService.AcceptPairRequest(request.HashedCid, senderName),
onDecline: () => _pairRequestService.DeclinePairRequest(request.HashedCid));
onDecline: () => _pairRequestService.DeclinePairRequest(request.HashedCid, senderName));
}
private void HandlePairRequestsUpdated(PairRequestsUpdatedMessage _)

View File

@@ -220,9 +220,13 @@ public sealed class PairRequestService : DisposableMediatorSubscriberBase
});
}
public void DeclinePairRequest(string hashedCid)
public void DeclinePairRequest(string hashedCid, string displayName)
{
RemoveRequest(hashedCid);
Mediator.Publish(new NotificationMessage("Pair request declined",
"Declined " + displayName + "'s pending pair request.",
NotificationType.Info,
TimeSpan.FromSeconds(3)));
Logger.LogDebug("Declined pair request from {HashedCid}", hashedCid);
}

View File

@@ -32,7 +32,6 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
private readonly ServerConfigurationManager _serverManager;
private readonly TokenProvider _tokenProvider;
private readonly LightlessConfigService _lightlessConfigService;
private readonly NotificationService _lightlessNotificationService;
private CancellationTokenSource _connectionCancellationTokenSource;
private ConnectionDto? _connectionDto;
private bool _doNotNotifyOnNextInfo = false;
@@ -54,7 +53,6 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
_serverManager = serverManager;
_tokenProvider = tokenProvider;
_lightlessConfigService = lightlessConfigService;
_lightlessNotificationService = lightlessNotificationService;
_connectionCancellationTokenSource = new CancellationTokenSource();
Mediator.Subscribe<DalamudLoginMessage>(this, (_) => DalamudUtilOnLogIn());