From 57d560e91247dc27a9b70bed8f4acafcbb9e03b1 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 17 Dec 2024 14:27:41 -0600 Subject: explicitly exclude search responses when broadcasting --- src/slskd/Search/API/Hubs/SearchHub.cs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/slskd/Search/API/Hubs/SearchHub.cs b/src/slskd/Search/API/Hubs/SearchHub.cs index b1fbf725..b4d2b6f0 100644 --- a/src/slskd/Search/API/Hubs/SearchHub.cs +++ b/src/slskd/Search/API/Hubs/SearchHub.cs @@ -39,16 +39,19 @@ namespace slskd.Search.API /// /// Broadcast an update for a search. /// + /// + /// Responses are removed prior to sending. + /// /// The hub. /// The search to broadcast. /// The operation context. public static Task BroadcastUpdateAsync(this IHubContext hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Update, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Update, search with { Responses = null }); } /// - /// Broadcast the present application options. + /// Broadcast a newly recieved search response. /// /// The hub. /// The ID of the search associated with the response. @@ -59,14 +62,32 @@ namespace slskd.Search.API return hub.Clients.All.SendAsync(SearchHubMethods.Response, new { searchId, response }); } + /// + /// Broadcast the creation of a new search. + /// + /// + /// Responses are removed prior to sending. + /// + /// The hub. + /// The search to broadcast. + /// The operation context. public static Task BroadcastCreateAsync(this IHubContext hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Create, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Create, search with { Responses = null }); } + /// + /// Broadcast the deletion of a search. + /// + /// + /// Responses are removed prior to sending. + /// + /// The hub. + /// The search to broadcast. + /// The operation context. public static Task BroadcastDeleteAsync(this IHubContext hub, Search search) { - return hub.Clients.All.SendAsync(SearchHubMethods.Delete, search); + return hub.Clients.All.SendAsync(SearchHubMethods.Delete, search with { Responses = null }); } } -- cgit v1.2.3